Photo "next" and "back"

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
web_master
Forum Newbie
Posts: 3
Joined: Tue Oct 09, 2007 9:16 am

Photo "next" and "back"

Post by web_master »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


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:

Code: Select all

<?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?

[s]thanx[/s] thanks in advanced
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You're looking for something like pagination. Do a forum & Google search & you should get the idea.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply