Sure I
could do that but I need to sort the array for this particular problem - any
other suggestions?
-----Original Message-----I would add order by lname to the query.
From: Jeff Mayfield [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 9:04 AM
To: [EMAIL PROTECTED]
Subject: Re: Help with Arrays
Jeff
At 6/7/2001 07:40 AM, you wrote:
I need help sorting the array alphabetically by last name. Here is the code:
<CFQUERY NAME="test" DATASOURCE="sales">
SELECT id, fname, lname
FROM reps
</CFQUERY>
<CFSET myarray=ArrayNew(2)>
<CFLOOP QUERY="TEST">
<CFSET myarray[CurrentRow][1]=test.id[CurrentRow]>
<CFSET myarray[CurrentRow][2]=test. fname[CurrentRow]>
<CFSET myarray[CurrentRow][3]=test.lname[CurrentRow]>
</CFLOOP>
<CFSET Total_Records=Test.RecordCount>
<CFLOOP INDEX="Counter" FROM=1 TO="#Total_Records#">
<CFOUTPUT>
ID: #MyArray[Counter][1]#,
FIRST NAME: #MyArray[Counter][2]#,
Last NAME: #MyArray[Counter][3]#
<BR>
</CFOUTPUT>
</CFLOOP>
- Dave
