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

Insert # into database

Explorer ,
Apr 17, 2008 Apr 17, 2008

Copy link to clipboard

Copied

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

Views

269

Translate

Translate

Report

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

Copy link to clipboard

Copied

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#'.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Use two of them.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST
Thanks.

I feel kinda stupid now!
It works 100%

Votes

Translate

Translate

Report

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
Documentation