can some help me please to check my code below , what wrong with these codes so my photo gallery not display correctly , or maybe you guys have better solution ?
this my codes that i am using .
###################################################
<ul>
<?php
//Determine number of record to show per page.
$display = 10;
//Determine how many page they are.
if (isset($GET['np'])) { //Allready been determined.
$num_pages = $GET['np'];
}else //Ned to determine.
{
//count number of records.
$query = "SELECT COUNT(*) FROM photos";
$result = mysql_query($query, $dbc) or die (mysql_error());
$row = mysql_fetch_array ($result, MYSQL_NUM);
$num_records = $row [0];
//Calculate the number of page
if ($num_records > $display) {//More than one page.
$num_pages = ceil ($num_records/$display);
}else{
$num_pages = 1;
}
}//End of if statement.
// Determine where in the database to start returning results.
if (isset($GET['s'])) {
$start = $GET['s'];
} else {
$start = 0;
}
//Make query
$query = "SELECT id, photosml FROM photos LIMIT $start, $display";
$result = mysql_query ($query); //Run the query.
?>
<?php do{ ?>
<li><a href="2007galleryportugalview.php?id=<?php echo $row ['id'];?> "><img src="portugal/<?php echo $row ['photosml'];?>"/></a>
</li>
<?php } while ($row = mysql_fetch_assoc($result)); ?>
<?php
if ($num_pages > 1) {
echo '<br /><p>';
// Determine what page the script is on.
$current_page = ($start/$display) + 1;
// If it's not the first page, make a Previous button.
if ($current_page != 1) {
echo '<a href="2007galleryportugal.php?s=' . ($start - $display) . '&np=' . $num_pages . '">Previous</a> ';
}
// Make all the numbered pages.
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $current_page) {
echo '<a href="2007galleryportugal.php?s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';
} else {
echo $i . ' ';
}
}
// If it's not the last page, make a Next button.
if ($current_page != $num_pages) {
echo '<a href="2007galleryportugal.php?s=' . ($start + $display) . '&np=' . $num_pages . '">Next</a>';
}
echo '</p>';
} // End of links section.
?>
</ul>
################################################
and you can check the error on: http://oceandragonracing.co.uk/pictures/photos/2007season/2007galleryportugal.php
Thank you