john_6767 Posted May 26, 2006 Share Posted May 26, 2006 hey,just started using php and was wondering how i can select a specific record from a recordset (i used to do this in asp). To put you in the picture i have a photo gallery which is a page that diplsays a whole heap of thumbnails form a db, i have another page that loads when a thumbnail is clicked and shows the full version of the image. i want to get this page with the full image to have a previous and next image button which is where i come unstuck.. at the moment both page recordsets are just sorted by imageID and so the previous/next work on the large image page but i can't get the page to show the image from the page before..(it just shows the first imageID, i have a repeat region on the page set to 1..) i assume there is a standard way to do this and its pretty easy? Am i going about this the wrong way?thanks in advance..-John Link to comment https://forums.phpfreaks.com/topic/10481-select-specific-record-from-recordset/ Share on other sites More sharing options...
poirot Posted May 26, 2006 Share Posted May 26, 2006 I can't understand you. Can't you just create a Previous and Next based on the current (Previous = ID-1 | Next = ID+1)? Link to comment https://forums.phpfreaks.com/topic/10481-select-specific-record-from-recordset/#findComment-39103 Share on other sites More sharing options...
john_6767 Posted May 26, 2006 Author Share Posted May 26, 2006 [!--quoteo(post=377219:date=May 26 2006, 02:55 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 26 2006, 02:55 PM) [snapback]377219[/snapback][/div][div class=\'quotemain\'][!--quotec--]I can't understand you. Can't you just create a Previous and Next based on the current (Previous = ID-1 | Next = ID+1)?[/quote]I don;t think that will work as the id's aren't guaranteed to be consecutive numbers.. its from a db (so if i have ID's 1 2 3 4 and then i delete ID 3 i have the ID's 1 2 4 in which case when i click next on ID 2 i would get an error, yes?). Please correct me if i am wrong, i am sure there has to be an easy way to do this i'm just not seeing it..cheers Link to comment https://forums.phpfreaks.com/topic/10481-select-specific-record-from-recordset/#findComment-39107 Share on other sites More sharing options...
poirot Posted May 26, 2006 Share Posted May 26, 2006 Oh that's true. In this case:[code]// Previous:SELECT id FROM `table` WHERE id < CURRENT LIMIT 1// Next:SELECT id FROM `table` WHERE id > CURRENT LIMIT 1[/code]Should work. Link to comment https://forums.phpfreaks.com/topic/10481-select-specific-record-from-recordset/#findComment-39111 Share on other sites More sharing options...
john_6767 Posted May 31, 2006 Author Share Posted May 31, 2006 [!--quoteo(post=377227:date=May 26 2006, 03:20 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 26 2006, 03:20 PM) [snapback]377227[/snapback][/div][div class=\'quotemain\'][!--quotec--]Oh that's true. In this case:[code]// Previous:SELECT id FROM `table` WHERE id < CURRENT LIMIT 1// Next:SELECT id FROM `table` WHERE id > CURRENT LIMIT 1[/code]Should work.[/quote] cheers, i get the idea, but i have been using dreamweaver to create my sql statements, could you please let me know how i would put this on a page., i.e. what goes before and at end of this statement in the php tags. I am a complete newbie.. but i should catch its just i've never done sql statements in php before.. thanks for your advice, Link to comment https://forums.phpfreaks.com/topic/10481-select-specific-record-from-recordset/#findComment-40414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.