Is there a way to get each row's value from a database into an array?

Posted by Guyver on Stack Overflow See other posts from Stack Overflow or by Guyver
Published on 2013-05-08T11:15:02Z Indexed on 2013/06/26 16:21 UTC
Read the original article Hit count: 175

Filed under:
|

Say I have a query like the one below. What would be the best way to put each value into an array if I don't know how many results there will be? Normally I would do this with a loop, but I have no idea how many results there are. Would I need run another query to count the results first?

<CFQUERY name="alllocations" DATASOURCE="#DS#">
    SELECT locationID 
    FROM   tblProjectLocations
    WHERE  projectID = '#ProjectName#'
</CFQUERY>

© Stack Overflow or respective owner

Related posts about coldfusion

Related posts about coldfusion-9