If I understand you correctly, you want the second version of your SQL
statement to happen only if the user selects a category, otherwise use the
first.

Presumably, your select box will look like:

<select name="category">
    <option value="">All Categories</option>
    <option value="1">1</option>
    ...
</select>

All you need is to have your query look like:

    SELECT *
    FROM advert_details
    WHERE county = '#Form.county#'
    <cfif category is not "">
            AND category = #Form.category#
    </cfif>

Hope that helps,

Dana

-----Original Message-----
From: WL <[EMAIL PROTECTED]>
To: Cold Fusion Talk <[EMAIL PROTECTED]>
Date: Friday, June 23, 2000 4:22 PM
Subject: Parsing Data to the same page


>Hi,
>
>This is going to seem trivial for all of you, but I hope you can spare me a
>min.
>
>I have a page, in which I want it to modify a SQL query depending on a
>users' selection.  For exampls, the following SQL:
>
>SELECT * FROM advert_details WHERE county = 'berks'
>
>What I need to do is have a Select drop down box, which I have dynamically
>populated, as a second option - "To filter data, please choose a
category" -
>then that would modify the SQL,hopefully, to read:
>
>SELECT * FROM advert_details WHERE county = 'berks' and category = 143
>
>How can I do this?
>
>Thanks,
>
>Will
>
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to