dealTek wrote: > my fmstudio code query looks something like this... > > --------------------------- > > .... query lines then > > ends with this > $test_result = $test_find->execute(); > > > then i loop thru like this > > > > <?php foreach($test_result->getRecords() as $test_row){ ?> > <tr> > <td> > > <?php echo $test_row->getField('Client_ID'); ?> > <?php echo $test_row->getField('Contact_First'); ?> > <?php echo $test_row->getField('Contact_Last'); ?> > </td> > <td> </td> > <td> </td> > <td> </td> > </tr> > <?php } ?> > > > Q: I am confused: > > 1 - HOW DO I RE-SORT THIS BEFORE THE LOOP DISPLAY = $test_result ????? Assuming that $test_result->getRecords() returns an array[1], you could do the following: <?php $records = $test_result->getRecords(); // sort by last name usort($records, function ($a, $b) { return strcmp( $a->getField('Contact_Last'), $b->getField('Contact_Last') ); }); ?> <?php foreach ($records as $test_row) { ?> <!-- the rest as before --> -- Christoph M. Becker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php