Im trying to understand when to use and not use <cfoutput>. Could someone please look at the following four examples (all of which use cfoutput) and tell me whether or not they need it:
=========EXAMPLE 1 "dbfields" is a local list==========
<cfquery name="checkbdup" datasource="mydata" maxrows="1">
SELECT max(bID) AS bill_id FROM billing
WHERE 0=0
<cfloop list="#dbfields#" index="i">
<cfif len(evaluate(i))>
<cfoutput>
and #i# = '#evaluate(i)#'
</cfoutput>
</cfif>
</cfloop>
</cfquery>
============EXAMPLE 2 setting from query==========
<cfif checkbdup.bill_id is NOT "">
<cfoutput query="checkbdup">
<cfset billingID = #checkbdup.bill_id#>
</cfoutput>
<cfelse>
=======EXAMPLE 3 (variables passed by form========
<cfquery datasource="mydata">
insert into billing
(firstname,lastname,phone,fax,email,address1,address2,city,state,zip)
VALUES
<cfoutput> ('#firstname#','#lastname#','#phone#','#fax#','#email#','#address1#','#address2#','#city#','#state#','#zip#')
</cfoutput>
</cfquery>
====EXAMPLE 4 (variables from 2 places passed to sql)====
<cfloop collection="#session.cart#" item="i">
<cfquery name="qAddOrderItem" datasource="mydata">
insert into order_items
frn_order_id,frn_product_id,quantity)
VALUES <cfoutput query="qGetOrderID">
(#qGetOrderID.order_ID#,
</cfoutput>
<cfoutput>'#session.cart[1]#',
#session.cart[4]#
</cfoutput>)
</cfquery>
</cfloop>
=========EXAMPLE 1 "dbfields" is a local list==========
<cfquery name="checkbdup" datasource="mydata" maxrows="1">
SELECT max(bID) AS bill_id FROM billing
WHERE 0=0
<cfloop list="#dbfields#" index="i">
<cfif len(evaluate(i))>
<cfoutput>
and #i# = '#evaluate(i)#'
</cfoutput>
</cfif>
</cfloop>
</cfquery>
============EXAMPLE 2 setting from query==========
<cfif checkbdup.bill_id is NOT "">
<cfoutput query="checkbdup">
<cfset billingID = #checkbdup.bill_id#>
</cfoutput>
<cfelse>
=======EXAMPLE 3 (variables passed by form========
<cfquery datasource="mydata">
insert into billing
(firstname,lastname,phone,fax,email,address1,address2,city,state,zip)
VALUES
<cfoutput> ('#firstname#','#lastname#','#phone#','#fax#','#email#','#address1#','#address2#','#city#','#state#','#zip#')
</cfoutput>
</cfquery>
====EXAMPLE 4 (variables from 2 places passed to sql)====
<cfloop collection="#session.cart#" item="i">
<cfquery name="qAddOrderItem" datasource="mydata">
insert into order_items
frn_order_id,frn_product_id,quantity)
VALUES <cfoutput query="qGetOrderID">
(#qGetOrderID.order_ID#,
</cfoutput>
<cfoutput>'#session.cart[1]#',
#session.cart[4]#
</cfoutput>)
</cfquery>
</cfloop>