Can you put a cf comment inside the cfquery?
example:

<cfquery name="list" datasource = "#dsn#">
<!--- this is a comment, will this query run --->
SELECT Name, Age
FROM studentTable
WHERE Age = 20

</cfquery>

Recommended Answers

All 4 Replies

The best way to answer that type of question is to try it. Did you? :)

you are right! however, i am just new in coldfusion. I am just in the process of learning the language. In our company, there is an auto feed that populates 1 of our tables in certain time of the month. I'd like to test if his query does the feeds. but before i take it of the script, id like to make it as a comment and see if my hunch is correct. so if you could help me before this feed happens to my site, that would be great. but if you cant tell me, that's ok.

Im asking only if the script will run or should i put it outside the cfquery script?

Yeah, it will run fine as long as the right syntax is used <!--- comment --->. CF comments are skipped/removed when the code executes. So they're only visible to you, not the receiving program.

You can test it by create a page that displays the current time
<!--- what happens to this comment? --->
<cfoutput>#now()#</cfoutput>

Run the page and do a view source. Notice CF comment isn't visible in the generated html? It's automatically removed when CF compiles the code.

(When I first learned CF, I didn't realize CF comments have 3 dashes "-". So I was only using 2 and kept wondering why it didn't work ;)

Thank you Arrrgh!!! I hope that what I did to the script will not ruin our site. I will let you know if the auto feed will not affect my main table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.