Question
search interface
well i am currently working on a search system of my databsae
where i am bit confusd, i have ones ingle field for search.
the serach it makes with the table properties which carry the values of city, subdision and type of property as forien keys to the properties table. these three are all numeric as they carry the promary key value of their own.
so i amended up something like this:
but it does not seems to be working..i am using mysql
here is te code what i try to fing out, i want that if any user enter cityname the search show him all the properties belonging to that search..
<cfquery name="Recordset1" datasource="#request.dsn#">
SELECT properties_details.*, cityname as dCity,
property_type_name as ptype, Subdivion_name as sub_name
FROM properties_details
JOIN cities ON
cities.cities_id = properties_details.city_id
JOIN properties_types ON
properties_types.ptype_id = properties_details.ptype_id
JOIN cities_subdivision ON
cities_subdivision.sub_id = properties_details.sub_id
WHERE 0=0
<CFIF URL.search_string is not "">
AND property_unique_name LIKE '%#URL.search_string#%'
</CFIF>
<CFIF URL.search_string is not "">
AND cityname LIKE '%#URL.search_string#%'
</CFIF>
<CFIF URL.search_string is not "null">
AND Subdivion_name LIKE '%#URL.search_string#%'
</CFIF>
<CFIF URL.search_string is not "">
AND property_type_name LIKE '%#URL.search_string#%'
</CFIF>
</cfquery>
the serach it makes with the table properties which carry the values of city, subdision and type of property as forien keys to the properties table. these three are all numeric as they carry the promary key value of their own.
so i amended up something like this:
but it does not seems to be working..i am using mysql
here is te code what i try to fing out, i want that if any user enter cityname the search show him all the properties belonging to that search..
<cfquery name="Recordset1" datasource="#request.dsn#">
SELECT properties_details.*, cityname as dCity,
property_type_name as ptype, Subdivion_name as sub_name
FROM properties_details
JOIN cities ON
cities.cities_id = properties_details.city_id
JOIN properties_types ON
properties_types.ptype_id = properties_details.ptype_id
JOIN cities_subdivision ON
cities_subdivision.sub_id = properties_details.sub_id
WHERE 0=0
<CFIF URL.search_string is not "">
AND property_unique_name LIKE '%#URL.search_string#%'
</CFIF>
<CFIF URL.search_string is not "">
AND cityname LIKE '%#URL.search_string#%'
</CFIF>
<CFIF URL.search_string is not "null">
AND Subdivion_name LIKE '%#URL.search_string#%'
</CFIF>
<CFIF URL.search_string is not "">
AND property_type_name LIKE '%#URL.search_string#%'
</CFIF>
</cfquery>