Hi guys,
I'm new to this and could do with a bit of help, please.
I have a db in MySql which I need to be able to navigate around using buttons on the page. The buttens would allow the user to goto first, previous, next and last record.
I've gotten so far but have hit a brick wall now.
here is my code so far:
<?
if (!isset($employid))
{
$employid=1;
}
else
{
if (isset($action)){
if($action == "first")
{
$employid=1;
}
elseif ($action == "prev")
{
$employid=$employid-1;
}
elseif ($action == "next")
{
$employid=$employid+1;
}
else
{
$employid=7;
}
}
}
basically, I have two problems.
- how do I stop the previous button taking the user back beyond record 1.
I tried the following to determine the last record in order to get the last record button, but there seems to be a parsing problem that I can't work out.
mysql_select_db("PDS");
$query = "SELECT * FROM employee
$result = mysql_query($query);
num_results = mysql_num_rows($result);
Sorry it's a long one,
Cheers, 🙂