You can only use the <cfset var> syntax at the very top of the function (following the arguments).
Roland -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Roberson Sent: Wednesday, June 28, 2006 6:32 PM To: [email protected] Subject: [CFCDev] Problem with local var in CFC methods I keep getting this error when I invoke my cfcs: "Local variable rsArticles on line 34 must be grouped at the top of the function body" Here is what my method looks like: <cffunction name="getArticles" access="public" returntype="query"> <cfargument name="artID" required="no" type="numeric" default=0> <cfargument name="authID" required="no" type="numeric" default=0> <cfargument name="catID" required="no" type="numeric" default=0> <cfparam name="queryparam" default=""> <cfif artID NEQ 0> <cfset queryparam = " AND articles.artID = #arguments.artID#"> </cfif> <cfif authID NEQ 0> <cfset queryparam = queryparam & " AND articles.artauthor_ID = #arguments.authID#"> </cfif> <cfif catID NEQ 0> <cfset queryparam = queryparam & " AND articles.artcat_ID = #arguments.catID#"> </cfif> <cfset var rsArticles = 0> <cfquery name="rsArticles" datasource="#variables.dsn#"> SELECT artID, artcat_ID, artauthor_ID, artTitle, artDesc, artContent FROM articles WHERE articles.artActive = 1 #preservesinglequotes(queryparam)# ORDER BY artID DESC </cfquery> <cfreturn rsArticles> </cffunction> ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
