i am using this function to match the team name in...
# cfml-general
g
i am using this function to match the team name in the database table in mysql:
Copy code
<cffunction name="formatTeam">
        <cfargument name="teamName" required="false" default="">
        <cfreturn trim(replace(arguments.teamName, "'", "\'", 'ALL'))>
    </cffunction>
but it is ending like this in my check
Copy code
select count(*) as count
from teams
where team IN ('Mots','Leaf\\''s')
doing a check like this:
Copy code
<cfset local.teamName = formatTeam(arguments.teamName)>
select count(*) as count
from teams
where team IN (<cfqueryparam cfsqltype="VARCHAR" list="true" value="#local.teamName#" />)
its is stored in database as:
leaf's
a
OK, so, what... you want it to be compared as...
leaf\'s
?
g
i just want to match it using the query and return me the count that it exists
a
But hang on. You're dicking around with the value and substituting
'
for
\'
for some reason. Why?
g
the table is throwing me an error if i do
wait, let me try something
a
Tables don't throw errors.
Queries might.
What's the error?
And... like... if you want help, answer questions.
g
figured out, there is no need to format function
👍 1
because cfqueryparam is going to take care of it
👍 1
problem solved
a
That's what I figured. Hence the questions to clarify
👍 1