Currently I have the gallery set up dynamically so that each gallery reloads on the same page but with a different id (which i get from the mysql database) for example, gallery.html?id=5. At the end of each page i'd like a gallery navigation system with previous ( for ex. gallery.html?id=4) and next (for ex. gallery.html?id=6).
This is my code
<div class="scroll-gallery">
<?
mysql_connect("$DBHost","$DBUser","$DBPass");
$result=mysql("$DBName","SELECT * FROM project where id = '$projid'");
while($row=mysql_fetch_row($result)) {
$pid=$row[0];
$pid1 = $pid+1;
$pid2 = $pid-1;
$result2=mysql("$DBName","SELECT COUNT(id) FROM project");
while($row=mysql_fetch_array($result2)) {
$totalNum = $row['COUNT(id)'];
}
}
if ($pid>1){ echo"<a href=\"project.html?id=$pid2\"
class=\"prev\">Prev Project</a><span class=\"separ\">"; }
if ($pid<$totalNum){ echo"<span class=\"separ\"><a
href=\"project.html?id=$pid1\" class=\"next\">Next Project</a><span
class=\"scr-numb\">"; }
?>
</div>
But as its going by the id in the database, if a record is erased from the database i need it to skip to the next available id number otherwise a blank page will show. I cant get it to do this please help

New Topic/Question
Reply




MultiQuote






|