Too illustrate my point I took Davids original code and used the Order
Details table from the Northwinds database that comes with SQL Server. I
looped over Davids code and my code below 5 times. Davids code came back
with times of 2464,2483,2494. The code below came in with times of
2223,2243,2163. These results were taken after a few run throughs so that
caching and any pcode optimization had already taken place. Not to mention
the code below is much easier to read.
<cfquery datasource="northwind" name="checkuser">
SELECT *
FROM [Order Details]
</cfquery>
<table>
<cfloop from="1" to="5" index="i">
<cfoutput query="checkuser">
<tr valign="top">
<td>#orderid#</td>
<td>#productid#</td>
<td>
<cfif unitprice is 15.2>
<a href="JobAd.cfm?CustomerID=#orderID#">Create a job ad</a>
</cfif>
<a href="EditCustomer.cfm?Fn=#discount#&ID=#orderid#">Edit</a> |
<cfif unitprice is 15.2>
<a href="Delete.cfm?Fn=#discount#&ID=#orderID#">Inactivate</a>
<cfelse>
<a href="Reanimator.cfm?Fn=#discount#&ID=#orderID#">Re-activate</a>
</cfif>
</td>
</tr>
</cfoutput>
</table>
<br>
</cfloop>
Here is Davids original code after I changed the fieldnames:
<cfquery datasource="northwind" name="checkuser">
SELECT *
FROM [Order Details]
</cfquery>
<cfloop from="1" to="5" index="i">
<table>
<cfloop query="checkuser">
<cfoutput>
<tr valign="top">
<td>#orderid#</td>
<td>#productid#</td>
<td></cfoutput>
<cfif unitprice is 15.2>
<cfoutput><a href="JobAd.cfm?CustomerID=#orderID#">Create a job ad</a>
</cfoutput>
</cfif>
<cfoutput><a href="EditCustomer.cfm?Fn=#discount#&ID=#orderid#">Edit</a>
|</cfoutput>
<cfif unitprice is 15.2>
<cfoutput><a
href="Delete.cfm?Fn=#discount#&ID=#orderID#">Inactivate</a></cfoutput>
<cfelse>
<cfoutput><a
href="Reanimator.cfm?Fn=#discount#&ID=#orderID#">Re-activate</a></cfoutput>
</cfif>
<cfoutput>
</td>
</tr></cfoutput>
</cfloop>
</table>
<br>
</cfloop>
jon
----- Original Message -----
From: "Nick Texidor" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, February 11, 2001 7:54 PM
Subject: Re: Bizarre disappearing page - help!!!
>
>
> > Also <cfloop> is the second slowest tag in cf. Get rid of the <cfloop
> > query="queryName">, and just use <cfoutput query="queryname">. You will
> > speed that program up quite a bit.
>
>
> hmm, apparently, CFLOOP is faster than CFOUTPUT, especially when you are
> doing a bit more work than simply outputting fields.
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists