I have the following code that someone gave me on this forum. It works, but when I click the next page, I loose all the graphics such as logo, background image, and navigation buttons from my site. Is there a way to make this work?
$limit = 9;
$con = mysql_connect("$server","$userid","$pass") or die ("Huh? What Server");
$db = mysql_select_db("$database",$con) or die("I said WHAT database");
if (empty($offset) || $offset < 0) {
$offset=0;
}
if (empty($index)) $index=0;
$getrows = mysql_query("select from $dbtable", $con);
$numrows=mysql_num_rows($getrows);
$path ="/Images/TShirts/";
$type =".gif";
$shtml =".shtml";
$linkpath ="TShirts/";
$query = mysql_query("select from $dbtable ORDER BY image DESC limit $offset,$limit", $con);
echo "<table align=center width=60% border=0 class=Sparkle><tr>";
$num=1;
while ($result=mysql_fetch_array($query)){
$num = ($num < 4 ? $num : 1);
$index++; / Increment the line index by 1 /
echo "<td align=center><a href=\"$linkpath".$result[image]."$shtml"."\"><img border=1 height=123 width=95 alt=\"".$result[image]."\" src=\"".$path.$result[image].$type."\"></a><br>$result[image]</td>";
if ($num==3 && $index!=$numrows)
echo '</tr><tr>';
$num++;
}
echo ("</tr></table>");
if ($numrows <= $limit) {
}
else {
if ($offset!=0) {
$prevoffset=$offset-$limit;
echo "<br><a onMouseOver=\"window.status='Previous $limit Results'; return true\"; href=\"$PHP_SELF?offset=$prevoffset&index=$prevoffset\"><B>[Previous]</B></a> ";
}
else echo "<b>[Previous]</b> ";
$pages = intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
}
for ($i=1;$i<=$pages;$i++) {
if (($offset/$limit) == ($i-1)) {
echo " <b>$i</b> ";
} else {
$newoffset=$limit*($i-1);
echo " <a onMouseOver=\"window.status='Page $i Results'; return true\"; href=\"$PHP_SELF?offset=$newoffset&index=$newoffset\"><B>$i</B></a> \n";
}
}
if (!((($offset/$limit)+1)==$pages) && $pages!=1) {
$newoffset=$offset+$limit;
echo " <a onMouseOver=\"window.status='Next $limit Results'; return true\"; href=\"$PHP_SELF?offset=$newoffset&index=$newoffset\"><B>[Next]</B></a><p>\n";
} else echo " <b>[Next]</b>";
}
mysql_close($con);
?>