alexbouchet Posted December 27, 2011 Share Posted December 27, 2011 Hey forum! I am currently developing a number search and I need some help creating a way to show similar results... For example if someone searches "2009" and there is no result for "2009" is there a way for me to query the database with "2007", "2008", "2010", "2011", etc. until I find a result? Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/253878-number-search/ Share on other sites More sharing options...
QuickOldCar Posted December 27, 2011 Share Posted December 27, 2011 I'm sure can use a do-while loop Lower the number by 1 , or use the decrement operator , until get some results Quote Link to comment https://forums.phpfreaks.com/topic/253878-number-search/#findComment-1301539 Share on other sites More sharing options...
scootstah Posted December 27, 2011 Share Posted December 27, 2011 I'm sure can use a do-while loop Lower the number by 1 , or use the decrement operator , until get some results But put a limit on it, so you don't have an infinite loop. Quote Link to comment https://forums.phpfreaks.com/topic/253878-number-search/#findComment-1301540 Share on other sites More sharing options...
alexbouchet Posted December 27, 2011 Author Share Posted December 27, 2011 Thank you so much! Seems to have worked a treat! Quote Link to comment https://forums.phpfreaks.com/topic/253878-number-search/#findComment-1301543 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.