Jump to content

[SOLVED] Problems with SELECT


zamp0e

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.