Question
search problem
I am making a simple search but when i enter some search
word, it generates an error like i enter "tango" as search keyword,
it generated error as: column tango not found..
here is the search code i am trying to do..
<cfquery name="Recordset1" datasource="#request.dsn#" username="#request.user#" password="#request.password#">
SELECT properties_details.*, suburbname,
profession
FROM properties_details
JOIN suburbs ON suburbs.suburb_id = properties_details.suburb_id
JOIN tenants ON tenants.tenantID = properties_details.tenant_id
WHERE properties_details.status = <cfqueryparam cfsqltype="cf_sql_varchar" value="Yes">
<cfloop index="i" list="#url.search_string#" delimiters=" ">
<CFIF url.search_string is not "">
AND property_unique_name LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR property_features LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR suburbname LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR profession LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR property_layout LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR price_range >= (#Left(i,6)#)
</CFIF>
<CFIF url.search_string is not "">
OR price_range <= (#right(i,6)#)
</CFIF>
</cfloop>
ORDER BY property_unique_name asc
</cfquery>
if i enter nothing it shows me properties list and if i enter something, it generates error:
Can anybody tell me what is happening here, i tried it for the last 3 days
here is the search code i am trying to do..
<cfquery name="Recordset1" datasource="#request.dsn#" username="#request.user#" password="#request.password#">
SELECT properties_details.*, suburbname,
profession
FROM properties_details
JOIN suburbs ON suburbs.suburb_id = properties_details.suburb_id
JOIN tenants ON tenants.tenantID = properties_details.tenant_id
WHERE properties_details.status = <cfqueryparam cfsqltype="cf_sql_varchar" value="Yes">
<cfloop index="i" list="#url.search_string#" delimiters=" ">
<CFIF url.search_string is not "">
AND property_unique_name LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR property_features LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR suburbname LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR profession LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR property_layout LIKE '%#i#%'
</CFIF>
<CFIF url.search_string is not "">
OR price_range >= (#Left(i,6)#)
</CFIF>
<CFIF url.search_string is not "">
OR price_range <= (#right(i,6)#)
</CFIF>
</cfloop>
ORDER BY property_unique_name asc
</cfquery>
if i enter nothing it shows me properties list and if i enter something, it generates error:
Can anybody tell me what is happening here, i tried it for the last 3 days
