Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFSET and quotation marks 1

Status
Not open for further replies.

rlatham

Programmer
Aug 23, 2000
51
US
I have created several variables with CFSET and they work fine the first 2 times, however after browsing the page in ColdFusion, this is what happens:
<cfset grade1=#g1#>; after browsing in Coldfusion it looks like <cfset grade1=&quot;#g1#&quot;>;

if it is a variable that stores a formatted date :
<cfset date1=dateformat(NOW(), &quot;mm/dd/yy&quot;)>; after browsing the pages a couple times it looks like:
<cfset date1='dateformat(NOW(), &quot;mm/dd/yy&quot;)'> .

would appreciate your help solving this problem. Thanks.
 
Try this:

<CFSET date1 = &quot;#dateformat(Now(), 'mm/dd/yy')#&quot;>

<CFSET grade1 = &quot;#g1#&quot;>

If g1 from database query write:

<CFOUTPUT QUERY=&quot;QueryName&quot;>
<CFSET grade1 = &quot;#g1#&quot;>
</CFOUTPUT>
 
you should avoid using #'s inside cfset alltogether.


<CFSET date1=dateformat(Now(), 'mm/dd/yy')>

<CFSET grade1=g1>

If g1 from database query write:

<CFOUTPUT QUERY=&quot;QueryName&quot;>
<CFSET grade1=QueryName.g1>
</CFOUTPUT>

(IMHO)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top