Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert # into database

Explorer ,
Apr 17, 2008 Apr 17, 2008
Hi

I have a problem.
I have the following
<cfset newcolor = "000000">

<cfquery name="UpdateColor" datasource="#application.db#">
UPDATE tblsites
SET SBGCOL = '#newcolor#'
WHERE USERID = #session.userid#
</cfquery>

...HOWEVER, i want to insert a # before posting the color var!

Please can someone explain how to do this!

Thanks in advance
Delon

TOPICS
Advanced techniques
287
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2008 Apr 17, 2008
Flashdakota wrote:
> Please can someone explain how to do this!

You escape it so that ColdFusion knows it is not a variable delimiter.
In ColdFusion you escape control characters by doubling them.

I.E.

SET SBGCOL = '###newcolor#'.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2008 Apr 17, 2008
Use two of them.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2008 Apr 17, 2008
LATEST
Thanks.

I feel kinda stupid now!
It works 100%
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources