Jump to content

mysql select last 3 rows, order by id ASC?


shortysbest

Recommended Posts

use DESC/ASC whatever you want to and do this...

$query24 = mysql_query("SELECT * FROM notifications WHERE to_id='$session' AND state='1' ORDER BY id DESC LIMIT 3 ");
$i=mysql_num_rows($query24)-1;
while($row=mysql_fetch_array($query24)){
  $array[$i]=$row;
  $i--;
}

should give you an idea on how to solve it, it's all about finding a nice way to solve the problem.

Archived

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

×
×
  • Create New...

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.