Re: Basic Dual Query Combine into one question
| From: | dealTek | Date: | Fri, 30 Jan 2015 00:29:07 +0000 |
| Subject: | Re: Basic Dual Query Combine into one question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324324@lists.php.net to get a copy of this message | ||
sorry - still feeling silly......
at the risk of this getting too long I'll just post this shorter bit
trying usort()
seems the item returned is an object --- $test_result?
- then I get this warning
Warning: usort() expects parameter 1 to be array, object given ....
so how do i :
- sort the object ($test_result) using field names?
- or turn the object into an array and then sort it with field names?
=====
<?php
function sorttest($a, $b) {
if($a->State == $b->State) {
return 0;
}
return ($a->State < $b->State) ? -1 : 1;
}
//usort($unsortedObjectArray, 'compare_weights');
usort($test_result, 'sorttest');
?>
On Jan 29, 2015, at 3:15 PM, dealTek <dealtek@gmail.com> wrote:
>
> .... 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 } ?>
>
--
Thanks,
Dave - DealTek
dealtek@gmail.com
[db-15]