Here are my functions.. and I listed the problems below it.. could someone please help me out?
function
case "sortdealer":
$limit=5;
$query_rows=mysql_query("SELECT * FROM $table WHERE ownerpic = '$ownerpic' order by owner", $db);
$numrows=mysql_num_rows($query_rows);
if (empty($offset))
{$offset=1; }
$result = mysql_query("SELECT * FROM $table WHERE ownerpic = '$ownerpic' order by owner limit $offset,$limit", $db);
listdealer($result);
break;
list data function
while($row = mysql_fetch_array($result))
{ }
if(!isset($limit))
{
$limit = 5;
}
if ($offset==1) {
$prevoffset=$offset-20;
print "<a href=\"$PHP_SELF?offset=$prevoffset\">PREV</a> \n";
}
// calculate number of pages needing links
$pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
// check to see if last page
if (!(($offset/$limit)==$pages) && $pages!=1) {
// not last page so give NEXT link
$newoffset=$offset+$limit;
print "<a href=\"$PHP_SELF?offset=$newoffset\">NEXT</a><p>\n";
}
PROBLEMS:
1) No links shown.. no prev, no next, no in between numbers... nothing.. but it limits 5 rows. Please help with some working exapmle.. I'm a real newbie..thanks
2) for the next, prev links.
i have something like this http://domain.com/script.php?template.inc&action=listdealer&refcode=1
one way if im not wrong is to simply add the parametaers ( ?template.inc&action=listdealer&refcode=1) behind the $php_self...,
but then the problem comes.. I have several 'CASES' which means if I click on a 'sorting' link on the page, the parameter changes.. so, is there a way to tell the browser to copy the entire URL instead of just the $php_self?
Thanks for your help.