The code I am placing on the page is as follows
Code:
<?php
echo ('photo_id is: $photo_id');
$SQL = 'SELECT photo_id, photo_filename, photo_caption, photo_description, photo_gallprice FROM memphoto WHERE photo_id = $photo_id ';
// execute SQL statement
$ret = mysql_query($SQL);
$numrows = mysql_num_rows($ret);
if (!$ret) { echo( mysql_error()); }
else {
while ($img = mysql_fetch_array($ret)) {
$id = $img['photo_id'];
$photo = $img['photo_filename'];
$caption = $img['photo_caption'];
$description = $img['photo_description'];
$price = $img['photo_gallprice'];
}
}
// set the initial value for previous and next image id
$prev = $next = 0;
// get the previous image
$sql = 'SELECT photo_id FROM memphoto WHERE photo_id < $photo_id ORDER BY photo_id DESC LIMIT 0, 1';
$result = mysql_query($sql) or die('Error, get image info failed. ' . mysql_error());
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_assoc($result);
$prev = $row['photo_id'];
}
//echo ("previous id is: $prev");
// get the next image
$sql = 'SELECT photo_id FROM memphoto WHERE photo_id > $photo_id ORDER BY photo_id ASC LIMIT 0, 1';
$result = mysql_query($sql) or die('Error, get image info failed. ' . mysql_error());
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_assoc($result);
$next = $row['photo_id'];
}
//echo ("next id is: $next");
?>
I now have the page working showing the problem at http://www.francisgreenock.co.uk/htm...thumbnails.php
Thanks for your help so far. I feel I am at last getting somewhere