Forums

This topic is locked

Search for "All" or "Any"

Posted 18 Nov 2003 18:18:38
1
has voted
18 Nov 2003 18:18:38 Floris Kruger posted:
The following was put together in DMX but I wish to be able to also allow for the optional "All" or "Any" search from the "Suburbs" column. In other words I want to give users the option to select "All" and have all the suburbs displayed as apposed to selecting one at a time. Any help will be much appreciated!

SELECT Listing, Type, City, Suburb, Price, Bedrooms, Bathrooms, OnSuite
FROM Main
WHERE Price BETWEEN varPrice1 AND varPrice2 AND Suburb = 'varSuburb' AND Type = 'varType' AND City = 'varCity'

varPrice1 0 Request.Querystring("Price1"
varPrice2 0 Request.Querystring("Price2"
varSuburb % Request.Querystring("Suburb"
varType % Request.Querystring("Type"
varCity % Request.Querystring("City"

Replies

Replied 18 Nov 2003 18:53:52
18 Nov 2003 18:53:52 Janusz Jasinski replied:
Can U have seperate code with:

SELECT *

Janusz

======================
janusz.monkey-it.co.uk
www.xlibris.co.uk

ASP | VBScript | IIS 5.1 | Windows XP Pro | Linux Redhat 9 | SuSE 9 Pro | Linux FreeBSD 4.9 | PHP 5.0.0 Beta 2 | MySQL 4.0 | Apache 2.0.48 | Macromedia Studio w/t Flash 2004 | Microsoft Office Pro 2003 | Mozilla Firebird 0.7 | IE 6 | B.O.R.E.D @ HoMe
Replied 18 Nov 2003 19:18:33
18 Nov 2003 19:18:33 Floris Kruger replied:
I suppose but what would that imply ...I'm truly dumb at this!

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Can U have seperate code with:

SELECT *

Janusz

======================
janusz.monkey-it.co.uk
www.xlibris.co.uk

ASP | VBScript | IIS 5.1 | Windows XP Pro | Linux Redhat 9 | SuSE 9 Pro | Linux FreeBSD 4.9 | PHP 5.0.0 Beta 2 | MySQL 4.0 | Apache 2.0.48 | Macromedia Studio w/t Flash 2004 | Microsoft Office Pro 2003 | Mozilla Firebird 0.7 | IE 6 | B.O.R.E.D @ HoMe
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 22 Nov 2003 05:38:38
22 Nov 2003 05:38:38 Nozomi Kugita replied:
&gt;What would that imply...
* is a wildcard. SELECT * means SELECT all the culumns in a table.

Or, You can also consider to use if statement in your WHERE clause.

SELECT Listing, Type, City, Suburb, Price, Bedrooms, Bathrooms, OnSuite
FROM Main

WHERE &lt;if statement: if a user selects "ALL", filter the query only by prices, for example&gt; &lt;else statment: if a user selects particular suburb, add the Suburb filter&gt;

Can something like this be implemented to your app?

- Noz

Reply to this topic