veroaero Posted August 1, 2008 Share Posted August 1, 2008 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'>» ".$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 More sharing options...
ainoy31 Posted August 1, 2008 Share Posted August 1, 2008 Seems like you are trying to paginate the pages. I am correct here? Link to comment https://forums.phpfreaks.com/topic/117758-help-with-previous-and-next-links/#findComment-605704 Share on other sites More sharing options...
.josh Posted August 1, 2008 Share Posted August 1, 2008 http://www.phpfreaks.com/tutorial/basic-pagination will show you the principle behind pagination. Link to comment https://forums.phpfreaks.com/topic/117758-help-with-previous-and-next-links/#findComment-605706 Share on other sites More sharing options...
veroaero Posted August 2, 2008 Author Share Posted August 2, 2008 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. ??? Link to comment https://forums.phpfreaks.com/topic/117758-help-with-previous-and-next-links/#findComment-606120 Share on other sites More sharing options...
LemonInflux Posted August 2, 2008 Share Posted August 2, 2008 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) Hope that gets you started ---------------- Now playing: Linkin Park - Ppr:Kut (Cheapshot & Jubacca ft. Rasco & Planet Asia) via FoxyTunes Link to comment https://forums.phpfreaks.com/topic/117758-help-with-previous-and-next-links/#findComment-606125 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.