Hi Guys, really need some help on this…it’s been kicking my ass all day!
I’m trying to create a photo browser so that when you click the Next and Prev buttons either the Next or Previous image is displayed, but i can’t seem to extract the ID’s for them. My code goes a bit like this:
[code=php]$query_image = “SELECT image_id, image_path, image_description
FROM gallery_images
WHERE group_id = $group_id”;
$results_image = mysql_query($query_image);
if ($results_image)
{
while ($row_array_image = mysql_fetch_row($results_image))
{
$fetched_image_id = $row_array_image[0];
$image_path = $row_array_image[1];
$image_description = $row_array_image[2];
if ($fetched_image_id == $image_id)
{
$image_string = ‘<tr bgcolor=”#333366″><td colspan=”3″><img src=”../’.$image_path.'” /></td></tr>’;
$nav_string = ‘<tr bgcolor=”#333366″><td><a href=”http://www.ugmfc.com/image_viewer.php?image_id=’.$prev.’&group_id=’.$group_id.'”><img src=”images/prevshot-n.gif” align=”left” /></a></td><td><div class=”description”>’.$image_description.'</div></td><td><a href=”http://www.ugmfc.com/image_viewer.php?image_id=’.$next.’&group_id=’.$group_id.'”><img src=”images/nextshot-n.gif” align=”right” /></a></td></tr>’;
}
}
echo $nav_string;
echo $image_string;
echo $nav_string;
}
As you can see in the $nav_string i have $next & $prev where the image_id should be. I’ve tried using:
[code=php]$next = mysql_result(query_image, $count);
Where $count was the current row number + 1 but it didn’t like having a variable for the row number. I’ve played with next(); & prev(); with no luck and also mysql_data_seek (but again i don’t think that liked the variable).
If you can help us out it would be much appreciated. Durbs