runnerjp Posted April 27, 2010 Share Posted April 27, 2010 If i use a query to limit results to 2 $small=mysql_query("select * from {$prefix}comments where msg_id_fk='130' order by com_id limit $second_count,2 "); while($rowsmall=mysql_fetch_array($small)) { how could i find the com_id number of the lastone so if i run a query again i can carryon from that number so something like $com=mysql_query("select * from comments where msg_id_fk='130' and com_id > '$thenumber' order by com_id");?> E.G - limit two would be 3 4 then if i ran $com=mysql_query("select * from comments where msg_id_fk='130' and com_id > '4' order by com_id");?> i would get the remainder 5 6 7 8 9 Link to comment https://forums.phpfreaks.com/topic/199982-find-last-post-number-from-limit-2/ Share on other sites More sharing options...
Psycho Posted April 27, 2010 Share Posted April 27, 2010 Just use LIMIT starting at $second_count+2 with an arbitrary large number for the second parameter. $com=mysql_query("select * from comments where msg_id_fk='130' and com_id > '4' order by com_id limit $second_count+2, 999999"); EDIT: I *think* you can add values in a limit clause. If not you will just need to do the addition before you create the query. Link to comment https://forums.phpfreaks.com/topic/199982-find-last-post-number-from-limit-2/#findComment-1049622 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.