Mooselyn Posted April 24, 2006 Share Posted April 24, 2006 I was wondering, can you and is there a way to execute table query to only list say like the last four rows of the database?[code]$sql="select * from updates";[/code]I am not sure how to write the limit and only print last four rows from the database meaning the last four inputs that were inputted into the database.... Hope this makes sense. Link to comment https://forums.phpfreaks.com/topic/8226-rows/ Share on other sites More sharing options...
sanfly Posted April 24, 2006 Share Posted April 24, 2006 How about this? Order by date or id or whatever you like[code] $sql = "SELECT * FROM updates ORDER BY whatever_field DESC LIMIT 4"; [/code] Link to comment https://forums.phpfreaks.com/topic/8226-rows/#findComment-29990 Share on other sites More sharing options...
Mooselyn Posted April 24, 2006 Author Share Posted April 24, 2006 Thank you yes that is what I was looking for, I actually almost guessed it before checking the board. I missed on the DESC and ASC. Link to comment https://forums.phpfreaks.com/topic/8226-rows/#findComment-29995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.