Any "<cfset var ... = .... " must be grouped at the top, right underneath any cfargument tags. If
looks like your cfset var location is 3/4 of the way down.
/Cody
Aaron Roberson wrote:
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]