le007 Posted September 27, 2007 Share Posted September 27, 2007 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 Edit/Delete Message Quote Link to comment https://forums.phpfreaks.com/topic/70822-a-sap-help-please/ Share on other sites More sharing options...
le007 Posted September 27, 2007 Author Share Posted September 27, 2007 Basically how do I limit the results/exclude some results? Somebody must know... Quote Link to comment https://forums.phpfreaks.com/topic/70822-a-sap-help-please/#findComment-356082 Share on other sites More sharing options...
teng84 Posted September 27, 2007 Share Posted September 27, 2007 How could I have something like if feature_type = "colour white" then don't include it in the result? select fields from table where field != "colour white" 1st----- 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. select fields from table where field in ('yellow', 'green', 'blue', 'white' ,' purple') 2nd---- In the 2nd if they click "all colours" that ONLY colour red and colour green would show up. select fields from table where field in (' red','green' ) now to have your second and fisrt select prod sort use a session something like if (isset($_POST[value])) $session = $_SESSION[value]+1; if ($session == 1) do the first query above else do the second query above Quote Link to comment https://forums.phpfreaks.com/topic/70822-a-sap-help-please/#findComment-356087 Share on other sites More sharing options...
le007 Posted September 27, 2007 Author Share Posted September 27, 2007 Thanks for getting back to me - I'm actually only loading this colours in from 2 separate text files! Any ideas now? Quote Link to comment https://forums.phpfreaks.com/topic/70822-a-sap-help-please/#findComment-356092 Share on other sites More sharing options...
le007 Posted September 27, 2007 Author Share Posted September 27, 2007 This is my SQL query $sql = "SELECT * FROM `tabel` WHERE `colour_type` like '$colour_type' > $sirsql = mysql_query($sql) or die(mysql_error()); Is there any way of doing this: $sql = "SELECT * FROM `tabel` WHERE `colour_type` like 'RED' OR `colour_type` like`GREEN`> $sirsql = mysql_query($sql) or die(mysql_error()); Edit/Delete Message Quote Link to comment https://forums.phpfreaks.com/topic/70822-a-sap-help-please/#findComment-356556 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.