the return variable has to match whatever it is you want to return. in *this* case, it's the query. let's say you just wanted to return a recordcount... then the return variable wouldn't match the query name. it'd match a variable name:
<cffunction name="getNumberOfUsers" output="false" returntype="numeric"> <cfset var myQuery = "" /> <cfset var howMany = "" /> <cfquery name="myQuery" datasource="#application.dsn#"> SELECT * FROM foo WHERE bar = 1 </cfquery> <cfset howMany = myQuery.recordcount /> <cfreturn myQuery.recordcount /> </cffunction> for what it's worth, the function above doesn't need the 'howMany' variable. you can simply <cfreturn myQuery.recordcount />. just trying to illustrate the use of variable names for you. also (and this might have been said already), in the interest of keeping the CFC black-boxed... the datasource name should be passed in (as opposed to referencing the application scope from within the CFC). On Wed, Oct 22, 2008 at 9:07 AM, Rick Faircloth <[EMAIL PROTECTED]>wrote: > but, but, but... I thought I saw CFC examples where the cfreturn variable > didn't match the query name. (It didn't make much sense, but then, again, > not a lot of the CFC "stuff" does, right now) > > The change made it work, however. > > Now I know. The cfreturn variable has to match the query name. > > Live and learn... > > Rick > > Charlie Griefer wrote: > > the problem isn't the empty query. an empty query is still a query. the > > problem is you're returning "featured_products" but your query is named > > "get_featured_products". you're returning an empty variable. > > change this line: > > > > <cfset var featured_products = "" /> > > > > to: > > > > <cfset var get_featured_products = "" /> > > > > then change your <cfreturn /> to return get_featured_products. > > > > On Wed, Oct 22, 2008 at 8:51 AM, Rick Faircloth < > [EMAIL PROTECTED]>wrote: > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314246 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4