Ninjakreborn Posted January 1, 2007 Share Posted January 1, 2007 [code]<?php require_once("./master/config/config.php"); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><?php require_once($docroot . "/master/includes/meta.inc.php"); ?><title>Fairly Honest Bills</title></head><body id="frontend"><div id="wrapper"><?phprequire_once($docroot . "/master/includes/header.inc.php");?> <div id="leftcol"><?phprequire_once($docroot . "/master/includes/leftnav.inc.php");?> </div> <div id="rightcol"> <div id="top"> <?phpif ($_GET['rownumberprev']) { $rownumber = mysql_real_escape_string($_GET['rownumberprev']);}elseif ($_GET['rownumbernext']) { $rownumber = mysql_real_escape_string($_GET['rownumbernext']);}else { $rownumber = 0;}$limit = 20; if (isset($_POST['submit']) || isset($_GET['submit'])) { $year = mysql_real_escape_string($_POST['year']); $month = mysql_real_escape_string($_POST['month']); $select1 = "SELECT * FROM specialimagesystem WHERE year = '$year' AND month = '$month' LIMIT $rownumber, $limit;"; $query1 = mysql_query($select1); $total_rows = mysql_num_rows($query1); while ($row1 = mysql_fetch_array($query1)) { echo "<div class=\"specialimages\">\n"; $target = "/specialimages/"; $width = "100px"; $height = "100px"; echo "<a href=\"{$target}{$row1[name]}\" class=\"thickbox\"><img src=\"{$target}{$row1[name]}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$row1[name]}\" /></a>"; echo "<br /></div>\n"; } } ?> <?php if (isset($_POST['submit2']) || isset($_GET['submit2'])) { $tags = mysql_real_escape_string($_POST['tags']); $select2 = "SELECT * FROM specialimagesystem WHERE tags LIKE '%$tags%' LIMIT $rownumber, $limit;"; $query2 = mysql_query($select2); $total_rows = mysql_num_rows($query2); while ($row2 = mysql_fetch_array($query2)) { echo "<div class=\"specialimages\">\n"; $target = "/specialimages/"; $width = "100px"; $height = "100px"; echo "<a href=\"{$target}{$row2[name]}\" class=\"thickbox\"><img src=\"{$target}{$row2[name]}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$row2[name]}\" /></a>"; echo "<br /></div>\n"; } } ?> </div><div class="pag"><?phpif (isset($_GET['submit1']) || isset($_POST['submit1'])) { if ($rownumber != 0) { $rownumberprev = $rownumber - $limit; echo "<a href=\"newarrivals.php?rownumberprev={$rownumberprev}&submit1=yes\">Previous Page</a>"; echo "<br />"; } if ($rownumber <= ($total_rows - $limit)) { $rownumbernext = $rownumber + $limit; echo "<a href=\"newarrivals.php?rownumbernext={$rownumbernext}&submit1=yes\">Next Page</a>"; }}if (isset($_GET['submit2']) || isset($_POST['submit2'])) { if ($rownumber != 0) { $rownumberprev = $rownumber - $limit; echo "<a href=\"newarrivals.php?rownumberprev={$rownumberprev}&submit2=yes\">Previous Page</a>"; echo "<br />"; } if ($rownumber <= ($total_rows - $limit)) { $rownumbernext = $rownumber + $limit; echo "<a href=\"newarrivals.php?rownumbernext={$rownumbernext}&submit2=yes\">Next Page</a>"; }}?></div> </div></div></body></html>[/code]A long time ago, I built a simple pagination script. A few months later Is lightly expanded it, and it's been used well for me. I reuse it all the time, and can normally have pagination up and running in just a matter of minutes, as opposed to recreating it every time. However there is now a problem. I need it to conform to this situation, thelimit works, but it's not producing next and previous links. I have a page with multiple search options coming here, based on which form it's coming from, I need it to do a different search, either search by term, or by (month, year), but for now, when it searches it works, that was all done, I am building in the pagination script, it recieved my limit, but it's not seeming to actually work with the pagination, normally as I said, I copy the top code in, the bottom come in, get a few variables ans it's ready to go, this time I tried to modify it, to fit this situation, but there's something I am missing. Quote Link to comment https://forums.phpfreaks.com/topic/32451-solved-pagination/ 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.