only one Posted May 9, 2007 Share Posted May 9, 2007 hi, i was wondering how you can order a 15 rows per page.. then go to the second one and order the next 15 etc.. Link to comment https://forums.phpfreaks.com/topic/50705-order-a-limit-and-then-go-to-next-page/ Share on other sites More sharing options...
only one Posted May 9, 2007 Author Share Posted May 9, 2007 i was thinking of using a while loop to select the stuff from the database.. then every loop contains $i++; but then i was stuk with where to put my if statement.. maybe if i tried $page = $_GET ; $pms = mysql_query("SELECT * FROM pm WHERE id='$pm_id' ORDER BY id DESC"); while ($message = mysql_fetch_array($pms) && $i<$page*15) { $i++; } but again im stuck... Link to comment https://forums.phpfreaks.com/topic/50705-order-a-limit-and-then-go-to-next-page/#findComment-249270 Share on other sites More sharing options...
AndyB Posted May 13, 2007 Share Posted May 13, 2007 Easy was is to use a LIMIT statement with the query to select only as many records as you want per page and identify the start record for each page ... $query = "SELECT * from $db_table WHERE id='$pm_id' ORDER by id DESC LIMIT $from, $limit"; Check the pagination tutorials if you need more help than that. Link to comment https://forums.phpfreaks.com/topic/50705-order-a-limit-and-then-go-to-next-page/#findComment-252304 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.