0
double quote in a SQL update
Contributor
,
/t5/coldfusion-discussions/double-quote-in-a-sql-update/td-p/778488
Mar 01, 2009
Mar 01, 2009
Copy link to clipboard
Copied
Here is the code :
<CFQUERY name="upd_user" datasource="#eft_formation#">
update users_eft
set nom='#form.nom#',
pnom='#form.pnom#',
etc ....
If I put a text with double quote in my form field in previous page,
all text after the double quote is lost by the update query.
First time I see this.
I have a lot of other forms with an update query, with no problem, the double quote pass in the sql update.
When returning #form.nom# and display before update, the value is good (with the double quotes).
After sql update , text is lost after the double quote.
Thanks for any help, direction where to look for ?
<CFQUERY name="upd_user" datasource="#eft_formation#">
update users_eft
set nom='#form.nom#',
pnom='#form.pnom#',
etc ....
If I put a text with double quote in my form field in previous page,
all text after the double quote is lost by the update query.
First time I see this.
I have a lot of other forms with an update query, with no problem, the double quote pass in the sql update.
When returning #form.nom# and display before update, the value is good (with the double quotes).
After sql update , text is lost after the double quote.
Thanks for any help, direction where to look for ?
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
plarts
AUTHOR
Contributor
,
/t5/coldfusion-discussions/double-quote-in-a-sql-update/m-p/778489#M72297
Mar 01, 2009
Mar 01, 2009
Copy link to clipboard
Copied
A bit farther in this trouble :
I have checked the value in the database, it is good,
the double quote are in the database,
and when displaying #get_user.nom# as a normal text, I get it.
and when using it in an <input> tag like :
<input value="#get_user.nom#" etc... >
the value is empty after the double quote.
So it seems this is a problem with the <input tag ?
Thanks for any clue.
Pierre.
I have checked the value in the database, it is good,
the double quote are in the database,
and when displaying #get_user.nom# as a normal text, I get it.
and when using it in an <input> tag like :
<input value="#get_user.nom#" etc... >
the value is empty after the double quote.
So it seems this is a problem with the <input tag ?
Thanks for any clue.
Pierre.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/double-quote-in-a-sql-update/m-p/778490#M72298
Mar 01, 2009
Mar 01, 2009
Copy link to clipboard
Copied
cfqueryparam solves problems like these. It also makes many
queries run faster.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/coldfusion-discussions/double-quote-in-a-sql-update/m-p/778491#M72299
Mar 01, 2009
Mar 01, 2009
Copy link to clipboard
Copied
Hi,
CF will replace your placeholder with the actual value before it sends the html page to the users browser. Have a look into the source code of the page that get's generated.
You need to replace " with "
<cfset test= replace(test, """", """, "all")>
4 quotes!
cheers,
fober
CF will replace your placeholder with the actual value before it sends the html page to the users browser. Have a look into the source code of the page that get's generated.
You need to replace " with "
<cfset test= replace(test, """", """, "all")>
4 quotes!
cheers,
fober
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/double-quote-in-a-sql-update/m-p/778492#M72300
Mar 01, 2009
Mar 01, 2009
Copy link to clipboard
Copied
quote:
Originally posted by: fober1
Hi,
CF will replace your placeholder with the actual value before it sends the html page to the users browser. Have a look into the source code of the page that get's generated.
You need to replace " with "
<cfset test= replace(test, """", """, "all")>
4 quotes!
cheers,
fober
htmleditformat() might include this. I know it looks after angle brackets.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/coldfusion-discussions/double-quote-in-a-sql-update/m-p/778493#M72301
Mar 01, 2009
Mar 01, 2009
Copy link to clipboard
Copied
A bit farther in this trouble :
I have checked the value in the database, it is good,
the double quote are in the database,
and when displaying #get_user.nom# as a normal text, I get it.
and when using it in an <input> tag like :
<input value="#get_user.nom#" etc... >
the value is empty after the double quote.
So it seems this is a problem with the <input tag ?
No, it's not a problem with the input tag. It's just simple truncation -- by the browser! Suppose you have
<cfset x = 'John "The Bull" Richards'>
<cfoutput><input type="Text" name="nickname" value="#x#"></cfoutput>
The output is
<input type="Text" name="nickname" value="John "The Bull" Richards">
The browser picks out what it expects to see, value="John ", and ignores the rest. Look at the source code, and you'll see that the text is all there in full.
To avoid that, apply Dan's suggestion
<cfoutput><input type="Text" name="nickname" value="#htmleditformat(x)#"></cfoutput>
or even
<cfoutput><input type="Text" name="nickname" value="#xmlformat(x)#"></cfoutput>
I have checked the value in the database, it is good,
the double quote are in the database,
and when displaying #get_user.nom# as a normal text, I get it.
and when using it in an <input> tag like :
<input value="#get_user.nom#" etc... >
the value is empty after the double quote.
So it seems this is a problem with the <input tag ?
No, it's not a problem with the input tag. It's just simple truncation -- by the browser! Suppose you have
<cfset x = 'John "The Bull" Richards'>
<cfoutput><input type="Text" name="nickname" value="#x#"></cfoutput>
The output is
<input type="Text" name="nickname" value="John "The Bull" Richards">
The browser picks out what it expects to see, value="John ", and ignores the rest. Look at the source code, and you'll see that the text is all there in full.
To avoid that, apply Dan's suggestion
<cfoutput><input type="Text" name="nickname" value="#htmleditformat(x)#"></cfoutput>
or even
<cfoutput><input type="Text" name="nickname" value="#xmlformat(x)#"></cfoutput>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

