Hi all, I'm trying to get only certain results from a search I've written. The problem is I have 2 separate search pages. 1st searches for specific features that are in a "feature_type" dropdown menu eg all colours colour red colour yellow colour green colour blue colour white colour purple 2nd searches for other specific features that are in the SAME dropdown menu but I have limited their search options to just be: all colours colour red colour green The problem is: when the user leaves "all colours" selected in the dropdown menu and clicks search ALL the colours come up in both search result pages. What I'd like is if they hit "all colours" in the first search that just yellow, green, blue, white and purple would show up. In the 2nd if they click "all colours" that ONLY colour red and colour green would show up. ANY help? I've tried if's and cases etc... How could I have something like if feature_type = "colour white" then don't include it in the result? Thanks
Hi Hemlata, $sql = "SELECT * FROM `tabel` WHERE `colour_type` like '$colour_type' > $sirsql = mysql_query($sql) or die(mysql_error());
for second page. modify the search if($page == 2){ if($color_all){ $q = "select * from `table` WHERE `color_type` LIKE 'red' OR `color_type` LIKE 'green' "; } }
Hello le007, Use sqls as.. $all_color = array(); if ($page == 'page1') { $all_color = array('red', 'yellow', 'green', 'blue', 'white', 'purple'); } else if ($page == 'page2') { $all_color = array('red', 'green'); } $sql = "SELECT * FROM `tabel` WHERE `colour_type` IN('".implode(', ', $all_color)."') "; $sirsql = mysql_query($sql) or die(mysql_error()); Code (markup): Hope this will solve your issue. Regards,