![]() |
PHP: Show 3 records from MySQL (exampel: ID: 5 22 87)
I'm feeling so stupid at the moment, but what's the best way to get MySQL to show lets say 3 records.
Example: I want to show record ID 5, 22 and 87 in on go. Sure I can do a query loop on each record like this Code:
$query_rsFiles = "SELECT * FROM products WHERE `ID` = '$the_ID'";Anyone here who might know the correct way of doing this? Once again.. Sorry for asking this... I know.. I should know things like this. |
Nevermind..
Found it I think.. $query_rsFiles = "SELECT * FROM products WHERE `ID` = '5' OR `ID` = '22' OR `ID` = '87'"; Not sure if OR is the best way to do it. |
select * from table where id=('5','22','87')
You aren't really playing with PHP at this point, you are playing wtih SQL statements. |
actually is it
Code:
select * from table where id IN (5,22,87) |
The OR that I'm using at the moment is working fine, but for sure I will give IN also a go,
And yes.. The ID is a numeric value. Thank you both for your answer. |
| All times are GMT +2. The time now is 01:57. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.