Jump to content

A-SAP help please!


le007

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.