Site Navigation Php

// Variables for navigating between previous and next record id
$previd = $id-1;
$nextid = $id+1;
// Your database connection code
$dbcnx = mysql_connect('localhost:', 'mysql','yourpass')
or die("Error Occurred");
mysql_selectdb("YourDB");
$query = "SELECT * FROM yourtable WHERE id='$id'";
$result = mysql_query($query, $dbcnx);
$row = mysql_fetch_array($result);
// Checking and displaying data
If (($id > 0) && ($id <= sizeof($row))) {
echo $row['your array'];
echo "Previous
Next";
} else {
if ($id < 1) {
echo "Beginning of Record Set"." ";
echo "Next";
} else {
echo "End of Record Set"." ";
echo "Previous";
}
}
?>