Ask a Question related to Coldfusion Database Access, Design and Development.
-
susie_blond #1
help with search
:D hi there guys, please can you help me, my search does not display any
results, please help me befor my boss gives me a spanking! Here are my pages
search.cfm and searchresult.cfm, please tell me where i went wrong and i'll
give you a big kiss!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>search</title>
</head>
<body>
Please enter your search text:
<table>
<form action="searchresult.cfm" method="post">
<tr><td>
Business Name: <input type="text" name="BusinessName" size="20">
<input type="hidden" name="BusinessName" value="#BusinessName#">
</td></tr>
<tr><td>
Description: <input type="text" name="Description" size="20">
<input type="hidden" name="Description" value="#Description#">
</td></tr>
<tr><td>
Tel: <input type="text" name="Tel" size="20">
<input type="hidden" name="Tel" value="#Tel#">
</td></tr>
<tr><td>
Email: <input type="text" name="Email" size="20">
<input type="hidden" name="Email" value="#Email#">
</td></tr>
<tr><td>
Website: <input type="text" name="Website" size="20">
<input type="hidden" name="Website" value="#Website#">
</td></tr>
<tr><td>
<input type="submit" value="search">
<input type="reset" value="clear">
</td></tr>
</form>
</table>
</body>
</html>
searchresult
<cfquery datasource="ele_stone" username="ele_stone" password="rock"
name="businesses">
select *
from ws_directory
where dud = 0
<cfif BusinessName neq "">
and BusinessName like '#BusinessName#%'
</cfif>
<cfif Description neq "">
and Description like '#Description#%'
</cfif>
<cfif Tel neq "">
and Tel like '#Tel#%'
</cfif>
<cfif Email neq "">
and Email like '#Email#%'
</cfif>
<cfif Website neq "">
and Website like '#Website#%'
</cfif>
order by BusinessName
</cfquery>
<html>
<head>
<title>Search Results</title>
</head>
<body>
<b><cfoutput>Found #businesses.RecordCount# Businesses</cfoutput></b>
<table>
<cfoutput query="businesses">
<tr><td>BusinessName: #BusinessName#</td></tr>
<tr><td>Description: #Description#</td></tr>
<tr><td>Tel: #Tel#</td></tr>
<tr><td>Email: #Email#</td></tr>
<tr><td>Website: #Website#</td></tr>
</cfoutput>
</table>
</body>
</html>
susie_blond Guest
-
ANN: InterAKT Site Search - search in multiple tables
Hello, We have just released a new product, MX Site Search, meant to help web developers and designers create a search form in their dynamic... -
#25786 [NEW]: PHP website uses cookies to remember last search phrase in search box
From: tipsen at imada dot sdu dot dk Operating system: - PHP version: Irrelevant PHP Bug Type: Unknown/Other Function Bug... -
Search within Search Results
I am trying to do a search within query results: My first search executes fine, but my second search uses the WHERE parameters of my first... -
search box HELP!
One of these should do:- http://perso.planetb.fr/newton/#text http://tinyurl.com/m2zm Andrew Morton -
XP Search - how to not search inside .ZIP files
Is there any way to make the Windows Explorer Search facility not search the contents of .ZIP files? -
-
-
Dan Bracuk #4
Re: help with search
The way to troubleshoot this is:
start with
select count(*)
from ws_directory
where dud = 0
and see what you get
then start adding your "and" lines
( eg and Description like '#Description#%')
one by one until your query returns 0.
Things that might help are:
1. putting a wildcard at the front of the string as well.
2. forcing casesensitivity (if your db supports it)
(where upper(description like '#ucase(Description)#%')
Dan Bracuk Guest



Reply With Quote

