prev next button problem
Posted: Fri Jul 23, 2004 3:52 am
this is the script i am using to increment the id and therefore display the next row of information but its not working. take a look for me plase and help me spot why it isnt running properly. the incremental id works but the records are not showing. plus there is something happenin with the id itself. there needs to be a condition that makes it start at id=1 and no lower.
Code: Select all
$result = mysql_query("select * from gstrialforma",$connection);
$check1= mysql_query("select MIN(id) as '{$_GET['id']}' from gstrialforma");
$check1 = mysql_fetch_object($check1);
$check2 = mysql_query("select MAX(id) as '{$_GET['id']}' from gstrialforma");
$check2 = mysql_fetch_object($check2);
echo "<table border=1 cellpadding=2 cellspacing=2 class=biggertext>";
echo "all table headers";
if ($myrow = mysql_fetch_array($result))
{
echo "all row information"
}
echo "</table>";
echo "<table><tr><td>";//below is my increment script to show the next row of information
if($check1->id != $_GET['id'])
{
$newid = $_GET['id']-1;
echo "<a href="tableview4.php?id=$newid" class="biggertext"><- Previous</a>";
}
if($check2->id != $_GET['id'])
{
$newid = $_GET['id']+1;
echo "<a href="tableview4.php?id=$newid" class="biggertext">Next -></a>";
}
echo "</td></tr></table>";
?>