Jump to content

Archived

This topic is now archived and is closed to further replies.

Mooselyn

Rows

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.