mATOK Posted August 16, 2006 Share Posted August 16, 2006 Hi, I would like to modify the following code so that I output the first 15 results, then build a new page for the next 15 and so on. I would also like to have a link at the bottom that shows like page numbers and arrows back and forth.I guess firstly I need to know how to output only 15 and then build a new page if necessary.[code]$eventid=$_POST['eventid'];$section=$_POST['section'];$note1=$_POST['note1'];$note2=$_POST['note2'];if (!$sort) { $q="SELECT * FROM print_notes ORDER BY effective_date DESC";}if (!strcmp($sort, 'date')) { $q="SELECT * FROM print_notes ORDER BY date DESC";}elseif (!strcmp($sort, 'edate')) { $q="SELECT * FROM print_notes ORDER BY effective_date";}elseif (!strcmp($sort, 'class')) { $q="SELECT * FROM print_notes ORDER BY class";}elseif (!strcmp($sort, 'company')) { $q="SELECT * FROM print_notes ORDER BY company";}elseif (!strcmp($sort, 'media')) { $q="SELECT * FROM print_notes ORDER BY media";}$rez=mysql_query($q) or die (mysql_error());if (mysql_num_rows($rez) == 0){ echo "<p>Currently there is no print notes</p>";}else { while ($i = mysql_fetch_array($rez)) { $img = $i['file']; echo "<table border=\"1\" width=700 style=\"border-collapse:collapse\" align=\"center\">"; echo "<tr><th class=\"pnotes\">Date</th><td class=\"pnotestd\">".$i['date']."</td>"; if ($path == $i['file']) { echo "<td rowspan=\"9\" align=\"center\">NO IMAGE TO DISPLAY"; echo "</td></tr>"; } else { echo "<td rowspan=\"9\" align=\"center\"><a href=".$i['file']." target=_blank>"; echo _imgResize($img, "225"); echo "</a></td></tr>"; } echo "<tr><th class=\"pnotes\">Effective Date</th><td class=\"pnotestd\">".$i['effective_date']."</td></tr>"; echo "<tr><th class=\"pnotes\">Issue</th><td class=\"pnotestd\">".$i['issue']."</td></tr>"; echo "<tr><th class=\"pnotes\">Class</th><td class=\"pnotestd\">".$i['class']."</td></tr>"; echo "<tr><th class=\"pnotes\">Company</th><td class=\"pnotestd\">".$i['company']."</td></tr>"; echo "<tr><th class=\"pnotes\">Media</th><td class=\"pnotestd\">".$i['media']."</td></tr>"; echo "<tr><th class=\"pnotes\">Instruction</th><td class=\"pnotestd\">".$i['instruction']."</td></tr>"; echo "<tr><td colspan=\"2\"> </td></tr>"; echo "<tr><td class=\"pnotes\" colspan=\"2\">Entered By: ".$i['user']."</td></tr>"; echo "<tr><th class=\"pnotes\" colspan=\"2\"><b><a href=upload/upload.php?eventid=".$i['print_note_num']."><i>EDIT THIS NOTE</i></a></th></tr>"; echo "</table>"; echo "<br />"; }}[/code] Link to comment https://forums.phpfreaks.com/topic/17742-how-to-display-15-results-then-a-new-page/ Share on other sites More sharing options...
brown2005 Posted August 16, 2006 Share Posted August 16, 2006 read up on the pagnation tutorial mate... easy to use as i new nothing and got it straight away Link to comment https://forums.phpfreaks.com/topic/17742-how-to-display-15-results-then-a-new-page/#findComment-75688 Share on other sites More sharing options...
mATOK Posted August 16, 2006 Author Share Posted August 16, 2006 I did not know one existed, thanx :) Link to comment https://forums.phpfreaks.com/topic/17742-how-to-display-15-results-then-a-new-page/#findComment-75695 Share on other sites More sharing options...
brown2005 Posted August 16, 2006 Share Posted August 16, 2006 yeah goto www.phpfreaks.com and select tutorials and then pagnation Link to comment https://forums.phpfreaks.com/topic/17742-how-to-display-15-results-then-a-new-page/#findComment-75697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.