Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Variable that stores query results.

0 views
Skip to first unread message

AkronNick

unread,
Dec 10, 2004, 1:15:14 PM12/10/04
to
I have a method that runs a select * query and then stores the results in a
variable. The variable needs to pass each result through to another method to
do something else. Right now I have it so that the variable only passes the
first row (I guess). But can somebody help me with the technique to I guess
loop through the rows, or whatever the correct way to do this would be? Many
thanks to the experts..

<cfset ftObj = CreateObject("component","#FTVAR_WEBROOT#.com.fusetalkapi")>

<cfset groupID=#URL.groupID#>
<cfset theCatID = #URL.catID#>
<cfset theSubType = "cat">
<cfset qGetGroupUsers = ftObj.GetGroupUsers(groupID, 4)>
<cfscript>
ftresult = ftObj.InsertSubscription(qGetGroupUsers.iuserid, theCatID,
theSubType);
</cfscript>

Adam Cameron

unread,
Dec 10, 2004, 8:50:00 PM12/10/04
to
> <cfset ftObj = CreateObject("component","#FTVAR_WEBROOT#.com.fusetalkapi")>
>
> <cfset groupID=#URL.groupID#>
> <cfset theCatID = #URL.catID#>
> <cfset theSubType = "cat">
> <cfset qGetGroupUsers = ftObj.GetGroupUsers(groupID, 4)>

<cfloop query="qGetGroupUsers">

> <cfscript>
> ftresult = ftObj.InsertSubscription(qGetGroupUsers.iuserid, theCatID,
> theSubType);
> </cfscript>

</cfloop>

One question:

Why have you done all those <cfset> tags in CFML, and then just the one
line done in <cfscript> instead? There's no gain to be had having ONE line
of <cfscript>. Yo might as well just have a <cfset>. Or - better - do the
whole lot in a <cfscript> block (you'd need to change you cfloop to a for()
loop, though, obviously.

--

Adam

0 new messages