Jabop Posted June 8, 2008 Share Posted June 8, 2008 I have a site where users view images. Simple. My prior method to displaying which image was using the record ID to get the image info Example: /images.html?view=3 <?php $DB->query("SELECT ID,Title FROM images WHERE ID<'".$_REQUEST['view']."' ORDER BY ID DESC LIMIT 1"); list($NextID,$NextTitle)=$DB->next_record(); ?> This would successfully select the next image in the database, in relation to the current Image ID. However, I have now changed the method that users view images Example: /images/image_title <?php $DB->query("SELECT ID,Title,FileName FROM images WHERE FileName<'".$_REQUEST['view']."' ORDER BY ID DESC LIMIT 1"); list($NextID,$NextTitle,$FileName)=$DB->next_record(); ?> This fails. The problem: Some rows are missing. Example 1-10 exist, 11, 12, 13 are missing, 14 exists, and so on. How can I select the next EXISTING record, based off of the FileName? Quote Link to comment Share on other sites More sharing options...
fenway Posted June 10, 2008 Share Posted June 10, 2008 This is ultimately a pagination issue... you can't use IDs for this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.