Ok, this is what I have set up and you get the idea on what I
am trying to
accomplish.
I have a table of my database called 'members'
Amongst other items I have columns called:
state: varchar(2)
service: TinyInt
keywords: LongText
When people sign up they choose their service from a list,
choose their
state from a list and enter keywords from a textbox which is
all inserted
into the table. They can enter it any way they want.
When people go to search, they have to choose a state and a
service
(required).
The keywords is optional and is a textbox. They may just put
random words in there or separate them with comma or such.
I need a SQL code written that will take the state and the
service which are
always chosen and add the option of keywords.
I would like this put into a CFC to use on the site.
How much would anyone / everyone charge me to do this for me?
I am at my
wits end and don't have the time to keep this request up.
I will probably learn better from seeing it completed then to
have people
send me to places.
If you need any other information, please ask.
Listed below is that I have currently. Everything works fine
except for the
keywords section. It works if one word is entered, but bombs
if you enter
more than one.
<cfcomponent>
<cffunction name="ServiceSearch" access="remote"
returntype="query">
<cfargument name="service" type="string"
required="true">
<cfargument name="state" type="string"
required="true">
<cfargument name="keywords" type="string"
required="false">
<cfquery name="ServiceResults"
datasource="#Request.MainDSN#">
Select company, name, phone, service, city, state, username
FROM members
WHERE service = #arguments.service# AND state =
'#arguments.state#'
<cfif len(trim(arguments.keywords)) GT 0>
AND keywords LIKE '%#Trim(arguments.keywords)#%'
</cfif>
ORDER BY company ASC
</cfquery>
<cfreturn ServiceResults>
</cffunction>
</cfcomponent>
Please let me know.
--
Wally Kolcz
Developer / Support