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. Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.