In message <[EMAIL PROTECTED]>, whoisquilty
<[EMAIL PROTECTED]> writes
>Any ideas of this?
>
>--- In [email protected], "whoisquilty" <[EMAIL PROTECTED]> wrote:
>>
>> Here is the full query to the MySQL database:
>>
>> $photoquery = "SELECT *
>> FROM photos
>> INNER JOIN songs ON songs.songid = photos.song
>> INNER JOIN productions ON productions.prodid =
>photos.production
>> WHERE photoid = $var";
>> $photoresult = mysql_query($photoquery) or die(mysql_error());
>> $photorows = mysql_num_rows($photoresult);
>>
>> while ($photo = mysql_fetch_array($photoresult))
>> {
>> print '<table width="64" border="0" cellspacing="0" cellpadding="5">
>> <tr>
>> <td>';
>>
>> print '<img src="../../gallery/'.$photo["product
>ion"].'/'.$photo
>> ["file"].'" border="0">';
>>
>> print '</td>
>> </tr>
>> <tr>
>> <td>'.$photo["caption"];
>>
>> if(!empty($photo["thanks"]))
>> {
>> print ' <i>(Thank you to '.$photo["thanks"].' for this image)</i>';
>> }
>>
>> print ' </td>
>> </tr>
>> </table>';
>> }
>>
>>
>> I've got a thumbnails page that people choose which photos they want to see
>full views
>of.
>> The photos are categorized by song and also categorized by production. Only
>the
>photos
>> from a certain production show up on a thumbnail page. So, on the thumbnail
>page, the
>> thumbnails from the chosen production show up categorized by song. Each
>> photo
>has a
>> sort number to keep them in a specific order.
>>
>> I want users to have the option of viewing thumbnails individually, or
>> cycling
>through
>> them on the full photo page that each thumbnail is linked to. This would
>> mean
>starting
>at
>> the photo that they click on a thumbnail, taking them to the full photo
>> page,
>and links
>on
>> the full photo page allowing them to move to the next photo in the sequence
>(if they
>come
>> into the sequence at a photo whose sort number is 5, they should be able to
>move
>forward
>> to 6 and backward to 4 without going back to the thumbnail page).
>>
>> So, the next/previous links need to stay within the confines of the specific
>production
>and
>> specific song that they are designated as.
>>
>> Sorry I was unclear...again.
$query=(SELECT photoid
FROM photos
INNER JOIN songs ON songs.songid = photos.song
INNER JOIN productions ON productions.prodid = photos.production
WHERE photoid < $var ORDER BY photoid DESC LIMIT 1)
UNION
(SELECT photoid
FROM photos
INNER JOIN songs ON songs.songid = photos.song
INNER JOIN productions ON productions.prodid = photos.production
WHERE photoid > $var ORDER BY photoid LIMIT 1)
will give you two records, one for previous photoid, and one for next
photoid.
Sometimes, it wont (because this is the first photo, or the last photo,
or the only photo)
(get first record)
if ( photoid < $var ) {
print <a href=... pid=$var>prev</a>
(get next record)
}
if (record read)
print <a href=... pid=$var>next</a>
... obviously untested...!
--
Pete Clark
Sunny Andalucia
http://www.hotcosta.com/comm_1.htm