Jump to content

Help with "previous" and "next" links


veroaero

Recommended Posts

Hello,

 

I am trying to figure out how to add "next" and "previous" links to a full view page in a photo album I am doing. I can't figure out how to do it in this case though and I would appreciate some hints/advice on how to do it.

 

Here is the php code where I am trying to add the links:

 

// 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 There are no photos in this category! \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'>&raquo ".$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>";

	}
}

 

Thanks in advance,

Vero

Link to comment
https://forums.phpfreaks.com/topic/117758-help-with-previous-and-next-links/
Share on other sites

Yes, I want to paginate my results. I know how to do that when I loop through my results, but here I have already decided which photo to show on the previous page, and I don't loop through the full view photos. I was just hoping for some simple hints how to get pagination in this case because I can't figure out how to do it.  ???

Have a get value of 10, 20, 30 etc. etc.

 

SELECT * FROM `table` WHERE `var` = `val` LIMIT { YOUR_GET_VALUE }, 10

 

That'll display 10 rows per page (well, with a bit of altering) :P

 

Hope that gets you started :)

 

----------------

Now playing: Linkin Park - Ppr:Kut (Cheapshot & Jubacca ft. Rasco & Planet Asia)

via FoxyTunes

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.