I am trying to do a query matching my trans_location column with the form data the user enters. I have a dropdown that lets the user choose multiple locations. When they choose multiple it places commas in between each location. When I choose only one location the results come back correct with the correct location. But when I choose more than one location it does not find any of the locations. Do the commas make it only one name and it will not search each location?
<cfset result = {} />
<cftry>
<cfset date1 = #CREATEODBCDATETIME(form.StartDate & '00:00:00')#>
<cfset date2 = #CREATEODBCDATETIME(form.EndDate & '23:59:59')#>
<cfquery datasource="#application.dsn#" name="GetLocationInfo">
SELECT *
FROM cl_checklists
WHERE date >= #date1# AND date <= #date2#
AND trans_location = '#form.Location#'
</cfquery>
<cfoutput>#date1#</cfoutput>
<cfoutput>#date2#</cfoutput>
<cfdump var="#GetLocationInfo#">
<cfcatch type="any">
<cfset result.error = CFCATCH.message >
<cfset result.detail = CFCATCH.detail >
</cfcatch>
</cftry>
I also tried doing something like this:
AND trans_location = <cfqueryparam value='#form.Location#' />