textbox Posted May 23, 2007 Share Posted May 23, 2007 Hello all, Right, I have the script that pulls out my bulletins title and author from the db. I can limit that to whatever i want, say 8. Hopefully, the database will be populated with loads of bulletins, id like to be able to limit the results to 8 per page and have a 'next page' text link that will pull out the next 9-17 results. If you know what I mean? Any help would be great. Here is my code so far! <?php //format a spacer for further down in the page, this is a local variable $spacer = " - "; //get the bulletin information from the table $query = mysql_query("SELECT * FROM bulletin WHERE timeposted ORDER BY timeposted ASC LIMIT 6"); if ($row = mysql_fetch_array($query)) { do { $timeposted = date("d F Y", strtotime($row["timeposted"])); $source = $row["source"]; $message_after_match = $row["message_after_match"]; $messageid = $row["messageid"]; $userquery = mysql_query("SELECT username FROM users WHERE source='$source'"); $user = mysql_result($userquery, 0, "username"); //this section prints out the variables needed on the page print "<tr> <td><div align='left'>Written by$spacer$user</div></td> <td><div align='left'>".$timeposted."</div></td> <td><div align='left'><a href='bulletin.php?bulletin=$messageid'>Read</a></div></td> </tr><P>"; } while ($row = mysql_fetch_array($query)); } else { //this is printed if nothing is found in the table print "<tr> <td></td> <td>No bulletin found!!!</td> </tr>"; } ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/52717-solved-next-page/ Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 LIMIT START, INTERVAL So if you wanted to start at 9 and go 8 more records LIMIT 9, 8 Quote Link to comment https://forums.phpfreaks.com/topic/52717-solved-next-page/#findComment-260280 Share on other sites More sharing options...
textbox Posted May 23, 2007 Author Share Posted May 23, 2007 Thanks Frost. Would anyone be able to help me with the php for this?! Quote Link to comment https://forums.phpfreaks.com/topic/52717-solved-next-page/#findComment-260287 Share on other sites More sharing options...
per1os Posted May 23, 2007 Share Posted May 23, 2007 http://www.phpfreaks.com/tutorials/43/5.php http://www.phpfreaks.com/tutorials/43/1.php Some tutorials on Pagination. Quote Link to comment https://forums.phpfreaks.com/topic/52717-solved-next-page/#findComment-260288 Share on other sites More sharing options...
textbox Posted May 23, 2007 Author Share Posted May 23, 2007 Thanks Frost!!! Quote Link to comment https://forums.phpfreaks.com/topic/52717-solved-next-page/#findComment-260289 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.