this tutorial is too good, man it gave me the exact outcome i wanted. thanks dude
Have you even wanted to search for multiple words in a search (but as separate elements)? If a user typed in:
"ColdFusion MX Tutorials"
in a search box, this tutorial will show you how to accuretly return results from your data, where each individual word is filtered from the data...
<CFQUERY NAME="searchresults" DATASOURCE="yourdatasource">
SELECT *
FROM table
WHERE 0=0
AND
(
<cfloop index="i" list="#form.searchkeyword#" delimiters=" ">
<cfoutput>fieldname LIKE '%#i#%' AND </cfoutput>
</cfloop>
'%%')
</CFQUERY>
it is so simple ......
this tutorial is too good, man it gave me the exact outcome i wanted. thanks dude
How could I create say 3 list menu´s that search different sections eg. price, location and style in the same product. I have tryed to find the info on this and can only find info on single text field search´s.
Helped reduce about 20 lines of code!! Thanks
What if you wanted to search on all the words individually? So it was OR instead of And. I tried this and it displayed all the records not instead of the words i inputted.
For Kiwi, how to handle multiple fields.
how would you go about using more than one fieldname in this query? e.g. you have 4 fields you wanted to search for the keywords in.