Forums

This topic is locked

Multiple Forms Search

Posted 21 May 2003 17:25:20
1
has voted
21 May 2003 17:25:20 Matt Jukes posted:
Hi all once again <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

I have a DB which I would like to search through using 5 Form Fields.

The Fields are Make, Model, Min Price, Max Price and Trim. These will be searching one Table with the same column names as the fields mentioned.

I have the following query set out;

SELECT *
FROM dbo.Main
WHERE Make LIKE 'varMAKE'
AND Model LIKE 'varMODEL'
AND Trim LIKE '%varTRIM%'
AND Price BETWEEN 'varMIN' AND 'varMAX'

I would like a client to be able to use and search with any/or all of these fields to yield a result (preferably not of 0).

Fields Make, Min & Max Price are Drop Down Boxes and Both Model and Trim are standard text fields. There are static values set in the three DD boxes, their values are set as %, so that if unchanged they will display all results regardless of that criteria. However when used they reveal no results, I realised that this was due to the Between Clause in the SQL Query however I do not know How to combat it. I have also tried changing the values to null, Nill or just "" (nothing) and none of these work. Anybody have any ideas on this please reply however no worries if not thanks in advance.

Matt

Replies

Replied 23 May 2003 10:57:51
23 May 2003 10:57:51 Julio Taylor replied:
have you tried enclosing all the variables with '%'?

-- J

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 27 May 2003 10:37:00
27 May 2003 10:37:00 Matt Jukes replied:
Sorry Julio,

Haven't checked posts in a while. Thanks that is what I did and it worked thanks for the advice<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Matt

Reply to this topic