Title: Help with Arrays

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

Reply via email to