Ask a Question related to Coldfusion Database Access, Design and Development.
-
rolty #1
Escaping characters in MySQL
CFMX works fine with MySQL database 99% of the time. However, when a field in
a query includes an apostrophe, CF is escaping it in the Windows SQL server
mode, ie by doubling the apostrophe. MySQL requires a backslash to achieve
this, and consequently any queries involving escaped characters are failing
although the data might actually tally. There must (surely) be a simple setup
for this but I cant find it, any helpers please?
rolty Guest
-
cf with mysql, escaping chars
Hi all, I am converting a rather larger parsing program from php to coldfusion. So far so good, until I found where it inserts data into the... -
Escaping special characters
How do I escape ' and other special characters? I use addslashes but that does not seem to prevent the MSSQL db from complianing. Please help. ... -
Escaping characters
I want to make a variable holding the string a href="#" onClick="alert('Are you sure you want to quit?')") But if I do <cfset theURL = "a... -
MySQL characters
As long as Im on the subject... Is there any way I can use characters such as: á,é,í,ó,ú,º,ª, etc in MySQL??? thanks -
ESCAPING USER ENTERED CHARACTERS.
Hi I have some blind users who use voice translation software to enter data into an MSQL 2000 db using ASP (Web) Occasionally I get ' or other... -
Jochem van Dieten - TMM #2
Re: Escaping characters in MySQL
rolty wrote:
Use cfqueryparam.> CFMX works fine with MySQL database 99% of the time. However, when a field in
> a query includes an apostrophe, CF is escaping it in the Windows SQL server
> mode, ie by doubling the apostrophe. MySQL requires a backslash to achieve
> this, and consequently any queries involving escaped characters are failing
> although the data might actually tally. There must (surely) be a simple setup
> for this but I cant find it, any helpers please?
Jochem
--
Jochem van Dieten
Team Macromedia Volunteer for ColdFusion, beer and fun.
Jochem van Dieten - TMM Guest
-
rolty #3
Re: Escaping characters in MySQL
thanks Jochem
that works with regular queries, but I cant get it to work with query of queries.... still get the same problem there... perhaps there's a nice workaround you know for that?
rolty Guest
-
Jochem van Dieten - TMM #4
Re: Escaping characters in MySQL
rolty wrote:
Could you show an example?>
> that works with regular queries, but I cant get it to work with query of queries.... still get the same problem there... perhaps there's a nice workaround you know for that?
Jochem
--
Jochem van Dieten
Team Macromedia Volunteer for ColdFusion, beer and fun.
Jochem van Dieten - TMM Guest
-
rolty #5
Re: Escaping characters in MySQL
sure! This is the master query: <cfquery name=master datasource=myDB> SELECT
EstablishmentDetails.RecordID, Name, EstType, EstTypeAlt, EstType2, EstType3,
Town, CountyName, EstablishmentDetails.description, website, email,
CountyDetails.Region AS Reg FROM CountyDetails INNER JOIN EstablishmentDetails
ON County = CountyDetails.RecordID OR County2 = CountyDetails.RecordID WHERE
List = 1 AND CountyDetails.RecordID = <cfqueryPARAM value = '#county#'
CFSQLType = 'CF_SQL_INTEGER' maxlength='3'> ORDER BY Name ;</cfquery> this
works fine. however when i query this query like: <cfquery name=QHotel
dbtype='query'> SELECT RecordID, Name, Town, description, website, email FROM
master WHERE Town = <cfqueryPARAM value = '#town#' CFSQLType =
'CF_SQL_VARCHAR'> AND (EstType = 1 OR EstTypeAlt = 1 OR EstType2 = 1 OR EstType
= 12) ;</cfquery> It doesnt return any rows, even if I know the data is there.
It works fine IF the 'town' field does not contain an apostrophe, it only
fails for towns like King's Lynn... have I got the CFSQLType wrong?
rolty Guest
-
Jochem van Dieten - TMM #6
Re: Escaping characters in MySQL
I'm sorry, I have not been able to reproduce this problem.
Jochem
--
Jochem van Dieten
Team Macromedia Volunteer for ColdFusion, beer and fun.
Jochem van Dieten - TMM Guest



Reply With Quote

