ColdFusion: need to loop through query and set session vars for output

currently capturing session vars for Application Admin user roles this way:
<CFIF #qry_findAppAdmin.recordCount# GT 0>
      <cfset session.AppAdminFName = #qry_findAppAdmin.first_name#>
      <cfset session.AppAdminLName = #qry_findAppAdmin.last_name#>
      <cfset session.AppAdminEmail = #qry_findAppAdmin.email_address#>
      <cfset session.AppAdminPhone = #qry_findAppAdmin.user_phone#>
      <cfset session.AppAdminFName = ''>
      <cfset session.AppAdminLName = ''>
      <cfset session.AppAdminEmail = ''>
      <cfset session.AppAdminPhone = ''>

Now must handle multiple Application Admin users, not just one. Am hung up on how to code an array or such to create multiple session variables. Immediate goal: need to send multiple emails (i..e. cfmail ) to multiple Application Administrators.

Thanks very much
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


The primary use of session variables is to maintain a login and other session-specific information.   It sounds like you should not use session variables for the purpose you've described.  The email addresses do not all belong to the person logged in, so don't asscociate them with his session.

To do what you want, simpley query the admin and loop through them using CFMAIL to email each one..
mchristopherAuthor Commented:
Understood. Just following (somewhat blindly) the template at hand.
Will try the loop and let you know.
Did that work?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mchristopherAuthor Commented:
I already solved the issue by looping through the query and converting the results into an array. I found the code to do this on Google, not through the answer posted. The answer told me what to do not how to do it.
Partial credit is my recommendation. Thanks.
That's no problem.

For future reference however, if you are going to grade below an "A" grade you need to ask for additional information first.   Your last post was that you would give it a try and let me know.  

Regarding the question, I don't know the specifics of your code (perhaps there is some unusual circumstance) but from what you posted, I stand by the answer... there's no need for you to create session variables or an array.  If you're just pulling the admins from the database, then simply loop through your query and send them each an email...

If you feel you need to do session variables or arrays or something, then the question does not supply enough information to justify it these extra steps.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.