Ok, actual code on this one!

<cfquery name="search" datasource="ds">
        select someFields from someTable where 1=1
        <cfloop index="currKeyword" list="#form.search#" delimiters=" ">
                AND searchField Like '%#currKeyword#%'          
        </cfloop>
</cfquery>

-----Original Message-----
From: Gavin Brook [mailto:[EMAIL PROTECTED] 
Sent: 09 November 2004 16:05
To: '[EMAIL PROTECTED]'
Subject: RE: Using Like Keyword for searching


This should work...

-----Original Message-----
From: Ben Densmore [mailto:[EMAIL PROTECTED] 
Sent: 09 November 2004 15:48
To: CF-Talk
Subject: Using Like Keyword for searching


I'm building in somewhat of a keyword search into a site I'm working on. The
search basically looks at what was typed into the search field, does a query
on a particular field in the database using the like keyword and then
returns a code or codes that is associated with that particular field in the
database.

The issue I'm having is if the value that is sotred in the db is something
like 
Cases: 24" - 30" and a person types in 24" cases in the search field the
query doesn't find anything.

My query looks like:
<cfquery name="search" datasource="ds">
 Select someFields
 from someTable
 where
 searchField Like '%#form.search#%'
</cfquery>

Now if you type 24 or 24" for example it will return the Cases: 24" - 30".

I wanted to do either a verity or Full text search but the client doesn't
want me to. Does anyone have any ideas on what I can do to get the query to
find anything that matches what is typed in?

Thanks,
Ben



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183738
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to