forumnz Posted December 30, 2007 Share Posted December 30, 2007 User can select an item from a drop down list when searching. Each item is assigned a number value (0,1,2,3 etc). When the user searches value 0, I want all the other values included because 0 basically means 'All'. If the user selects value 2, then I want all items with values 2,3,4,5,6,7,8 included, and if the user searches with value 9, then I want all items with 9,10,11,12,13 selected. The entries being searched in the db have space for a single value (like 3). How am I able to do this? Thanks heaps! Sam. P.S I have re-written this post to make it easier to understand. Quote Link to comment https://forums.phpfreaks.com/topic/83751-search-help/ Share on other sites More sharing options...
jvrothjr Posted December 30, 2007 Share Posted December 30, 2007 If they was values in the db (0,1,2,3,4....) you could have searched with value => '$a' Quote Link to comment https://forums.phpfreaks.com/topic/83751-search-help/#findComment-426112 Share on other sites More sharing options...
forumnz Posted December 30, 2007 Author Share Posted December 30, 2007 Yes, I have that already. But how can I get it so that if someone searches with value 0, it shows ALL entries? And if they search with value 2 is searches with all entries with values 2,3,4,5,6,7,8? Sam. Quote Link to comment https://forums.phpfreaks.com/topic/83751-search-help/#findComment-426113 Share on other sites More sharing options...
forumnz Posted December 30, 2007 Author Share Posted December 30, 2007 Is there another way I should do it? Quote Link to comment https://forums.phpfreaks.com/topic/83751-search-help/#findComment-426135 Share on other sites More sharing options...
jvrothjr Posted December 31, 2007 Share Posted December 31, 2007 use the where clause $query = select * from table where field = '$value' or field > '$value'; Quote Link to comment https://forums.phpfreaks.com/topic/83751-search-help/#findComment-426721 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.