Have you tried something like this
SELECT service_population,agency,city,state,salary_status
FROM internships
#preservesinglequotes( find_text )#
ORDER BY agency ASC
On Mon, 10 Jan 2005 13:10:06 -0500, Daniel Kessler <[EMAIL PROTECTED]> wrote:
> I'm doing my first Search utility:
> http://hhp.umd.edu/studentservices/internships.cfm
>
> I'm trying to build a WHERE clause in CF where it check to see if a
> form field is part of a search and if it is, then it builds into the
> WHERE string. Unfortunatley when I do, I get the error, "SQL command
> doesn't end properly" after clicking Search.
>
> Here's some of the code:
>
> <cfif structKeyExists(Form,"service_population") OR
> structKeyExists(Form,"agency") OR structKeyExists(Form,"city") OR
> structKeyExists(Form,"state") OR
> structKeyExists(Form,"salary_status")>
>
> <cfoutput>
> <--- setup a search --->
> <cfset find_text = "WHERE ">
> <cfif structKeyExists(Form,"service_population")>
> <!--- <cfset find_text ="WHERE service_population='children'">--->
> <cfset find_text
> ="#find_text#service_population='#Form.service_population#'">
> </cfif>
>
> <cfquery name="getSearchItem" datasource="dpch">
> SELECT service_population,agency,city,state,salary_status
> FROM internships
> #find_text#
> ORDER BY agency ASC
> </cfquery>
>
> </cfoutput>
> <cfelse>
> <--- setup some presets --->
> <cfset service_population = ''>
> <cfset agency = ''>
> <cfset city = ''>
> <cfset state = ''>
> <cfset salary_status = ''>
>
> </cfif>
>
> Also, if someone can just point me to a tutorial on this, then that'd be fine.
> Really, any help would be appreciated.
>
> --
> Daniel Kessler
>
> Department of Public and Community Health
> University of Maryland
> Suite 2387 Valley Drive
> College Park, MD 20742-2611
> 301-405-2545 Phone
> www.phi.umd.edu
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189825
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54