Jump to content

Photo "next" and "back"


web_master

Recommended Posts

Hi,

 

Ive got a problem.

 

I made a small "photo album", and this mean that with first script I list the pictures, and with this script below the viewer can list pictures "up" and "down" - in range of PhotoAlbum.

 

script is:

 

<?php
// Reload from dBase
$query = mysql_query (" SELECT * FROM `photo` WHERE `photo_album` = '".$_GET['photo_album']."' AND `photo_id` = '".$_GET['photo_id']."' ");
	if(!$query) {
		print mysql_error();
		exit;
	}
	$request = mysql_fetch_array($query);

// Reload file
$photo_print = "up_photo/".$request['photo_id']."_photo_file.jpg";
if(is_file($photo_print)) {
	$photo_print_php = "<img src=\"".$photo_print."\" alt=\"\" border=\"0\">";
} else {
	$photo_print_php = "";
}

// Next or Back
$photo_next = $request['photo_id'] + 1;
$photo_back = $request['photo_id'] - 1;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td><?php print $photo_print_php;?></td>
</tr>
	<caption align="bottom"><?php print $request['photo_caption'];?></caption>
</table>
<?php

?>


<form name="form_foto" action="<?php print "_photo_view.php?photo_album=".$request['photo_album']."&photo_id=".$photo_back;?>" method="post">
<input type="submit" name="submit_photo_next" value="BACK BUTTON">
<input type="hidden" name="photo_id" value="<?php print $request['photo_id'];?>">
<input type="hidden" name="photo_album" value="<?php print $request['photo_album'];?>">
</form>

<form name="form_foto" action="<?php print "_photo_view.php?photo_album=".$request['photo_album']."&photo_id=".$photo_next;?>" method="post">
<input type="submit" name="submit_photo_next" value="NEXT BUTTON">
<input type="hidden" name="photo_id" value="<?php print $request['photo_id'];?>">
<input type="hidden" name="photo_album" value="<?php print $request['photo_album'];?>">
</form>

 

1. I reload from dBase: photo_id, and photo_album (photo_album is a integer of a photo albums id from photoalbum table)

2. Reload the photo from file

3. Print (echo) the variabiles, and photo

 

There is a 2 forms, which function is to go "up" or "down" one picture IN RANGE OF PHOTOALBUM (photo_album).

 

That mean that the form can give me to go "up" and "down" only in range of $_GET['photo_album'] given in first part of script, when I reload from dBase.

 

The problem is, how can I do that?

 

thanx in advanced

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.