abrahamgarcia27 Posted June 3, 2012 Share Posted June 3, 2012 This is the following Structure of the problem i am dealing with Page bands.php -> Queries all the Results of Bands and ORDER BY band_name ASC WHERE STATUS = 1 Once Band is Clicked it goes to -> viewband.php WHERE band_id information is displayed Once in viewband.php -> i have a two buttons one for next band and one for previous band The question is how do i structure the query i dont want to display the next bigger id. Rather i want to display the next band WHERE that band_name is next AND WHERE STATUS = 1 Does any one have an idea on how i can structure this query? Quote Link to comment https://forums.phpfreaks.com/topic/263577-query-structure-help/ Share on other sites More sharing options...
Barand Posted June 3, 2012 Share Posted June 3, 2012 store currentBand in session var. SELECT id FROM bands WHERE bandname > '$currentBand' ORDER BY bandname LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/263577-query-structure-help/#findComment-1350790 Share on other sites More sharing options...
abrahamgarcia27 Posted June 3, 2012 Author Share Posted June 3, 2012 and where there is no next band or previous band? Quote Link to comment https://forums.phpfreaks.com/topic/263577-query-structure-help/#findComment-1350792 Share on other sites More sharing options...
Barand Posted June 3, 2012 Share Posted June 3, 2012 wrap round to first or last maybe? Quote Link to comment https://forums.phpfreaks.com/topic/263577-query-structure-help/#findComment-1350806 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.