Try this...give doesn't matter a unique value in the select list such as 5.

In your SQL then do...

select     stuff
from        table
where     conditions that will always be present
<cfif hashottub is not 5>and hashottub = #hashottub#</cfif>

*********** REPLY SEPARATOR  ***********
On 4/5/2001 at 9:21 AM P@tty Ayers wrote:

|Friends:
|
|I thought that I had this solved, but not quite. Can anyone help?
|
|The problem: I need to search on a "yes/no" column - several of them -
|allowing the user to choose that this field "Doesn't Matter" or else "Yes".
|There's a search page and a results page. The database has a column
|"cabinHottub", and the search form a menu "hashottub".
|
|I was given the following (below), which returns all records for the
|"Doesn't Matter" menu choice - but for some reason, *also returns all
|records for the "Yes" choice*. I'm sure this is something I've done
|incorrectly, but I'm afraid I don't know what. This code (see below) is
|exactly what I am currently testing.
|
|I feel like there should be something like
|<cfparam name="rs2__hashottub" default="#hashottub#">
|<cfparam name="hashottub" default="0">
|
|on the Results page as well, but I'm really not sure, obviously. Any help
|would be GREATLY appreciated, as I am really stuck on this, and just cannot
|find it in the reference books.
|
|Thank you again,
|
|P@tty Ayers
|Macromedia Evangelist
|
|-------------------------------------------------------------------------
|
|<!--- Menu search object from Search Page --->
|
|> Put a value of nothing in the option field for doesn't matter. see below:
|
|>         <p>Hot Tub: </p>
|>         <p>
|>           <select name="hashottub">
|>             <option VALUE="" selected>Doesn't Matter</option>
|>             <option value="1">Yes</option>
|>           </select>
|>         </p>
|
|----------------------------------------------------------------------------
|<!--- Query from Results Page: --->
|
|> <cfquery name="rs2" datasource=#MM_connAsheville_DSN#
|> username=#MM_connAsheville_USERNAME#
|password=#MM_connAsheville_PASSWORD#>
|> SELECT
|> cabins.cabinID, cabins.cabinName, cabins.cabinCity,
|> cabins.cabinBedrooms,
|> cabins.cabinBathrooms, cabins.cabinSleeps,
|> cabins.cabinNightly,
|> cabins.cabinWeekly, photos.photosThumbPhotoName
|> FROM cabins INNER JOIN photos ON cabins.cabinID |> photos.cabinID
|> WHERE
|> cabinDistance <= #rs2__vardistance#
|> AND
|> cabinBedrooms >= #rs2__varnumberbedrooms#
|> AND
|> cabinBathrooms >= #rs2__varnumberbathrooms#
|> AND
|> cabinSleeps >= #rs2__varsleepsatleast# ORDER BY
|> cabinName
|> <CFIF IsDefined("hashottub") and hashottub IS NOT "">
|> AND  hashottub = 1
|> </CFIF>
|> </cfquery>
|----------------------------------------------------------------------------
|-----
|
| |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to