PDA

View Full Version : Help required with advanced search page.


rjdineen
08-04-2010, 08:16 PM
Hello everyone.

I have created a search page for my website with a couple of drop down boxes, keyword text box and of course a search button.

The backend database is MYSQL with one table for testing purposes.

I know how to filter a search based on one drop down box while creating a variable and using it within a sql statment. But iam having trouble working out how to incorporate multiple variables into one statement.

for example. i have two variables

prodType
ProdCol

Both are drop down boxes. THe drop down boxes are called Type & Colour

so i have the following sql statement.

SELECT *
FROM postjobs
WHERE Type = ProdType and Colour = ProdCol

Not sure where i am going wrong.
Obviously i need the results to match what i am searching for and nothing else to be included in with the search results

Kind Regards

Rob

edbr
08-05-2010, 12:41 AM
first collect the values that you are passing

for example

$type= $_post=['ProdType
']
$customer= $_post=[customer
'']

SELECT *
FROM postjobs
WHERE Type = ProdTyp = $type
AND customer =
$customer

rjdineen
08-05-2010, 09:03 AM
Hello there

I have tried the following statement

SELECT *
FROM postItems WHERE ItemType = colname AND Colour = ColourCol

But my results is only filtered on the ItemType, when i search on the Colour I dont receive any results

Regards

Rob

rjdineen
08-07-2010, 08:32 PM
does anyone have any more ideas on this one?