[SOLVED] Pagniation help. Limit required?
Posted: Thu Apr 05, 2007 11:50 pm
I haven't been able to work out how to display
I guess before we look into the code, a question..
Do I *have* to use Limit on my SQL query to make this work?
tis, Will./
Does anyone have any examples that doesn't require the SQL to have a limit set. Could I use an array to store the data?Prev , 1,2,3.......34,35,36.Next
I guess before we look into the code, a question..
Do I *have* to use Limit on my SQL query to make this work?
Code: Select all
if ( $startrow - $this->pagesize > 0 ) { $prev = $startrow - $this->pagesize; } else { $prev = 0; }
$content .= " <a href = ".$script_name."?".$this->passargs."&fname=".$fname."&searchtext=".$searchtext."&startrow=".$prev.">Prev</a>\n";
for ( $i = 0; $i <= $this->numrows / $this->pagesize; $i++) { // Start Forloop
$startmp = $this->pagesize * $i ;
//if ( $i != 0 ) { $content .= "<b>,</b> "; }
if ( $startmp == $startrow ) {
$fontclass = "medium";
$maxpages = number_format($this->numrows / $this->pagesize, "0");
if ( $i < $maxpages ) {
$next = $this->pagesize * ($i+1);
} else {
$next = $this->pagesize * $i;
}
} else {
$fontclass="";
}
$content .= "<a href = ".$script_name."?".$this->
passargs."&fname=".$fname."&searchtext=".$searchtext."&startrow=" . $startmp." ><font class=".$fontclass.">".$i .", </font></a>";
} // End forloop
$content .= " <a href = ".$script_name."?".$this->passargs."&fname=".$fname."&searchtext=".$searchtext."&startrow=".$next.">Next</a>\n";