Reputation:
How do you put an order from the biggest to lowest?
I'm using:
mysqli_query($con, "SELECT * FROM builds
WHERE approved = 'yes' AND ORDER BY build_id LIMIT 0, 10");
but im geting this error:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\pcbuilds\index.php on line 9
Any way to make it work?
Upvotes: 0
Views: 97
Reputation: 1270713
You would use the desc
keyword to get the order from the biggest to the lowest:
SELECT *
FROM builds
WHERE approved = 'yes'
ORDER BY build_id DESC
LIMIT 0, 10;
Upvotes: 0
Reputation: 37253
your query looks wrong , you have AND alone.remove that AND
SELECT * FROM builds
WHERE approved = 'yes' ORDER BY build_id DESC LIMIT 0, 10
Upvotes: 1