I have the following script that devides the result into 9 items per page into rows of 3.
It also gives me NEXT and PREVIOUS links.
What do I need to do inorder to have links to the different pages in between the NEXT and PREVIOUS.
I want it to look something like this:
"<Previous Page 1 2 3 4 5 Next Page>" and the page that I'm on to be in BOLD ofcourse.
Here is my script:
if(!$rowstart) $rowstart=0;
$items_perpage=9;
$result = mysql_query("SELECT * FROM items WHERE type='$type' limit $rowstart,$items_perpage",$db);
$result2 = mysql_query("SELECT * FROM items WHERE type='$type'",$db);
$num = mysql_numrows($result);
mysql_close();
?>
<table bgcolor="#FFFFFF" border="1" bordercolor="#9DBFE9" cellpadding="0" cellspacing="0" align="center" width=750px>
<tr>
<td>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td height="30" width="37%" align="right" valign="middle" bgcolor="#D9D9D9"><img src=originals/subtit/<?echo $type ?>.gif></td><td align="left"><img src=originals/subtit/round.gif></td><td align="right"><font size="2" color="#666666">Click item for details </font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align="center" border="0" cellspacing="0" cellpadding="15" width="100%">
<tr></tr>
<?
$i=0;
$color1 = "#FFFFFF";
$color2 = "#FFFFFF";
$align1 = "left";
$align2 = "right";
$row_count = 0;
?>
<tr>
<? while ($i < $num) {
$id=mysql_result($result,$i,"id");
$price=mysql_result($result,$i,"price");
$picture=mysql_result($result,$i,"pic1");
$row_color = ($row_count % 2) ? $color1 : $color2;
$row_align = ($row_count % 2) ? $align1 : $align2;
?>
<td bgcolor="<? echo "$row_color" ?>" valign="middle"><font face="Arial, Helvetica, sans-serif"><a
href="large.php3?picture=<? echo "$picture"; ?>"
onclick="NewWindow(this.href,'name','475','550','no');return false;"><img
src="pics/thumbnails/<? echo "$picture"; ?>.jpg" border="1"</font></a><br>
<b><font face="Verdana" size="1" color="#666666">ID: </b><? echo "$id" ?><b> Price: </b><? echo "$price" ?></font>
</td>
<?
++$i;
if ($i % 3 == 0) {
print "</tr><tr align=$row_align>";
$row_count++;
}
}
?>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30" align="center" valign="middle" bgcolor="#ECECEC">
<b><?
if ($rowstart>$numrows)
{?>
<A HREF="<? $php_self ?>?type=<? echo $type ?>&rowstart=<? echo $rowstart-$items_perpage;?>"><font size=2>
<<< Previous Page</font></A>
<?}?>
::
<?
$numrows=mysql_num_rows($result2);
if($rowstart+$items_perpage<$numrows)
{?>
<A HREF="<? $php_self ?>?type=<? echo $type ;?>&rowstart=<?echo $rowstart+$items_perpage ;?>"><font size=2>
Next Page >>></font></A>
<? } ?></b>
</td>
</tr>
</table>
</td>
</tr>
</table>
Thank you!