This should take care of your previous button
To get your next button, just reverse the less the comparison symbol and the $orderby variable
$imagerequest = "select * from imagetable where (image_id < \"".$image_id."\")";
$orderby = "image_id DESC";
$result_previousimage=mysql_db_query($dbname,"".$imagerequest." order by ".$orderby." LIMIT 1");
$res_array_previousimage = mysql_fetch_array($result_previousimage);
if ($res_array_previousimage){
$previous_image_id = $res_array_previousimage["image_id"];
print("<a href=\"url/showphoto.php?imageId=".$previous_image_id."\">previous</a>");
}
peace