Jump to content

Recommended Posts

I'm having huge problems learning the sql syntax for INSERT, and how to properly use it to get an output in the browser.

 

For far too long now I have tried to simply print out the first 5 rows of my database, I have searched the web for tutorials on how to do this, and they all say the same; something like this:

 

SELECT * FROM table_name

 

That's all I've found, I know I have to declare it and stuff like that but I just don't know how.

 

So the question is, How do I get my browser to print out the 5 first lines of my database ?

Link to comment
https://forums.phpfreaks.com/topic/160541-solved-problems-with-select/
Share on other sites

I'd like to print out 5 rows where the ID is (1,2,3,4,5)

 

The thing I tried was something like:

SELECT name FROM iqtable WHERE ID=1
echo "$name"
SELECT name FROM iqtable WHERE ID=2
echo "$name"
SELECT name FROM iqtable WHERE ID=3
echo "$name"
SELECT name FROM iqtable WHERE ID=4
echo "$name"
SELECT name FROM iqtable WHERE ID=5
echo "$name"

 

Obviously, this is nowhere near right, as it's not working, and just looks plain stupid.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.