Has anybody got and idea or solutuion to page the results of subcatagories..
For that I am using this script for showing the results of my sub catagories.
$LIMIT = 2; #how many records per page (change this)
if (!($start = $HTTP_GET_VARS['start'])) //check to see where to start, default at 0
$start = 0;
#RETURN total rows in table
#only change the table name here, same table as $query (bellow)
$cntQuery = "SELECT COUNT(*) as cnt from books";
$rsCount = mysql_query($cntQuery) or die('failed query: ' . mysql_error());
$rowCount = mysql_fetch_row($rsCount);
$entryCount = $rowCount[0];
$TotalPages = ceil($entryCount / $LIMIT);
$CurrentPage = floor($start / $LIMIT);
ACTUAL GET ROW QUERY (which you probably already have)
#change the query as appropriate
$query = "SELECT * FROM books LIMIT $start,$LIMIT";
$rs = mysql_query($query) or die('failed query: ' . mysql_error());
$numrows= mysql_num_rows($rs);
echo $numrows;
mysql_close($dbh);
echo "<table width = \"100%\" border = 0>";
echo "<tr>";
while ($row = mysql_fetch_array($rs)){
echo "<td>";
$url = "show_book.php?isbn=".($row["isbn"]);
if (@file_exists("images/".$row["isbn"].".jpg"))
{
$x=$row["isbn"];
$y=$row["title"];
$y=addslashes($y);
do_checkbox($x);
$title = "<img src=\"images/".($row["isbn"]).".jpg\" border=0>";
do_html_url($url, $title);
$title = $row["title"]." by ".$row["author"];
do_html_url($url, $title);
}
echo "</td>";
}
echo "</table>";
if ($TotalPages > 1){ #only display if there's more than 1 page
if ($CurrentPage > 0)
echo '<a href="show_cat.php?catid=1?start=' . ($start-$LIMIT) . '"> < prev </a> ';
for ($i=1; $i<=$TotalPages; ++$i){
if (($i-1) == $CurrentPage)
echo " $i ";
else
echo ' <a href="show_cat.php?catid=1?start=' . (($i-1) * $LIMIT) . '">' . $i . '</a>';
}
if ($CurrentPage < ($TotalPages-1))
echo ' <a href="show_cat.php?catid=1?start=' . ($start+$LIMIT) . '"> next > </a>';
}
}
echo "<hr>";
}
However when I click on the next page it still stand on the same page and goes no where.
I guess the problem occurs by passing values to HTML
it doesnt understand
show_cat.php?catid=1?start=1
catid=1 is written by another script and start=1 is written by another script
did any body understand me? answer me quickly please