Re: Basic Dual Query Combine into one question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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>&nbsp;</td>
>       <td>&nbsp;</td>
>       <td>&nbsp;</td>
>     </tr>
>     <?php } ?>
> 






--
Thanks,
Dave - DealTek
dealtek@xxxxxxxxx
[db-15]


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux