Jump to content


Photo

Rows


  • Please log in to reply
2 replies to this topic

#1 Mooselyn

Mooselyn
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationMontana

Posted 24 April 2006 - 03:46 AM

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?

$sql="select * from updates";

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.



#2 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 24 April 2006 - 05:21 AM

How about this? Order by date or id or whatever you like

  $sql = "SELECT * FROM updates ORDER BY whatever_field DESC LIMIT 4";

If you're not part of the solution, you're part of the precipitate

#3 Mooselyn

Mooselyn
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationMontana

Posted 24 April 2006 - 06:20 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users