Ok, here is my example: I am trying to build next/previous links for this code:
In this example, I have the present id of the photo I am looking at, and I can get the rest of the photos in the same category, but they are not necessarily in order, can be id's like: 3, 4,5 7, 11.
// Full Size View of Photo
else if( $pid )
{
$result = mysql_query( "SELECT photo_caption,photo_filename,photo_id FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" );
$row = mysql_fetch_array($result) or die(mysql_error());
$photo_caption = $row['photo_caption'];
$photo_filename = $row['photo_filename'];
$photo_id = $row['photo_id'];
$nr = mysql_num_rows( $result );
if( empty( $nr ) )
{
echo"\t Oj! Det finns inga foton i den här kategorin! \n";
}
else
{
$result2 = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" );
$row2 = mysql_fetch_array($result2) or die(mysql_error());
$category_name = $row2['category_name'];
$result3 = mysql_query( "SELECT photo_id FROM gallery_photos WHERE photo_category='".addslashes($cid)."'" );
$row3 = mysql_fetch_array($result3);
echo"<br><a class='pinkLink' href='daif_vimmel.php?cid=$cid'>» ".$category_name."</a><br>\n";
echo"<div class='fullviewbox'> \n
<img class='fullview' src='".$images_dir."/".$photo_filename."' alt='".$photo_caption."' >\n
<br>\n
$photo_caption \n
</div>";
}
}
// Final Output
This might be a totally stupid question...