-2

I'm trying to assign the value of a column from the query to a variable using cfset tag. For example, if the value is 'abcd#1244', then if I use <cfset a = #trim(queryname.column)#> it will return only abcd. But I need the whole value of that column.

Fish Below the Ice
  • 1,273
  • 13
  • 23
  • Your question is incomplete. – Anit Kumar Jun 11 '15 at 12:32
  • 1
    What you're saying doesn't make any sense. If you were doing `` you'd see what you're suggesting, but if you're pulling data out of a query it should be fine. Does the variable actually hold the value you're expecting? Did you ``? I think we're going to need to see more of your code to provide a reasonable answer. – Fish Below the Ice Jun 11 '15 at 12:57

1 Answers1

-1

You will need to escape the # symbol. You can get clever and do it all in one swoop (# acts as an escape character when placed next to another #).

Example being

The item## is #variable#.

In order to print "The item# is 254."

There are plenty of text and string functions at your disposal.

I'd recommend first trying to escape the value as soon as it is drawn from your database.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html

TRose
  • 1,718
  • 1
  • 16
  • 32
  • 1
    No. Query values are NOT evaluated as cfml code, so there is no need to escape pound signs within the strings. It is only required if you hard code *literal* pound signs within cfml code OR if you used `evaluate(string)` which does evaluate the input string as cfml code. – Leigh Jun 12 '15 at 23:30