include "database.phph"; $count_sql = "select count(*) from photo"; $count_fetch = mysql($db, $count_sql); $image_count = mysql_result($count_fetch, 0); $min_sql = "select min(id) from photo"; $min_fetch = mysql($db, $min_sql); $image_min = mysql_result($min_fetch, 0); $max_sql = "select max(id) from photo"; $max_fetch = mysql($db, $max_sql); $image_max = mysql_result($max_fetch, 0); if ($image_count >= 1) { if ($id == "") { $id = $image_min; } if ($id < $image_max) { $next_sql = "select id from photo where id > $id"; $next_fetch = mysql($db, $next_sql); $nextid = mysql_result($next_fetch, 0); } else { $nextid = $image_min; } $image_sql = "select * from photo where id = $id"; $image_fetch = mysql($db, $image_sql); $image = mysql_fetch_object($image_fetch); print "\t
|
orange trucks eric (me) belize city belize (caves branch) road trip |
print "\t $image->description \n"; ?> |
new york chicago belize (drive to caves branch) belize (black hole) |