Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with query off a list

Status
Not open for further replies.

jrottman

Programmer
Jun 17, 2005
47
I have a fielda in my database, fld_bagent. In both this field I am storing the agent Id attached to a particular file number.

What I am trying to do is query my userlist table agaist the list. So that for every entry into the list, I can return all the user information for that user.

Here is what I am trying but it is only displaying one record instead of all the records for the query.

<cfquery name="test" datasource="#application.dsn#">
select * from tbl_smartPanel_propInfo_Sale
where fld_fileNum = 'S060099'
</cfquery>

<cfset agentList = ListAppend(test.fld_bagentId1, test.fld_sagentId1)>
<cfset counter = 1>
<cfloop from="1" to="#ListLen(agentList)#" index="counter">
<cfquery name="agentDisplay" datasource="#application.dsn#">
select * from tbl_smartPanel_userList
where fld_userlogin = '#ListGetAt(agentList, counter)#'
</cfquery>
<cfset counter = counter + 1>
</cfloop>

<cfoutput query="agentDisplay">#fld_fullname#</cfoutput>
 
Put the output inside the CFLOOP. You overwrite agentDisplay with every iteration of the loop, so you'll have to output the results before the next iteration.

HTH,

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Eschewing obfuscation diurnally.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top