Using Prev/Next while passing parameter

wxdqz

New Member
I created a next link to show 5 records at a time. It works fine except when I pass a parameter. With a parameter, the first 5 records work but the next stops returning the next five. I can't figure out why. Can someone help, here's the Next code portion I'm using (btw: this is an HDML site, which doesn't affect the PHP)
Thanks in advance,
<?php
$connection = mysql_connect("xxxx",
"xxxxx", "xxxxx")or die ("Couldn't connect to database");

$db = mysql_select_db("xxxxx") or die ("Couldn't select DB");

$limit = 5;
$sqlcount= "SELECT AA, BB, City FROM Table WHERE City='$city' ORDER BY BB";

$sql_countresult = mysql_query($sqlcount, $connection) or die ("Couldn't execute query");
$totalrows = mysql_num_rows($sql_countresult);

if(empty($page)){
$page = 1;
}

$limitvalue1 = $page*$limit-($limit);
$sql = "SELECT AA, BB, City FROM Table WHERE City='$city' ORDER BY BB LIMIT $limitvalue1, $limit";
$sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query");

//Data returned in HDML
while ( $row = mysql_fetch_array($sql_result) ) {
echo("<ce value='http://www.phpbuilder.com/board/archive/index.php/" . $row["AA"] . "'>");
echo("" . $row["BB"] . "");
echo("" . $row["AA"] . "");

}
echo "</choice><nodisplay name=card2>";



if(($totalrows-($limit*$page)) > 0){
$pagenext = $page + 1;
echo "<action type=accept task=\"go\" dest=\"products.php?City=$city&page=$pagenext\">";

// if the totalrows - $limit * $page is > 0 (meaning there is a remainder), leave the next button.
}


mysql_free_result($sql_result);
mysql_close($connection);
?>
</nodisplay>
</hdml>
 
Back
Top