I need to know how to sort database objects after one specific field.
I have a field in the database thats named "cat" where all objects have a number.
So when the URL is: http://localhost/?cat=2 all the images thats displayed should be only the ones who have the number 2 saved in their "cat" field.
How do I do that?
Here is the code I use for display ALL the items.
Code: Select all
$query = "SELECT * FROM object ORDER BY pic DESC" or exit (mysql_error());
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo '<a href="#"><img src="'.$row['pic'].'.jpg" alt=" "></a>';
}I appreciate all answers! Thanks!