Re: looking for an array sorting function.. just not sure which one..and how yet

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

 



On 03/10/2012 07:01 PM, Shawn McKenzie wrote:
> foreach ($query->result() as $row) {
>> 	$arr_cTree[$row->cID] = array($row->cPcID, $row->cL, $row->cName, $row->cSeg, $row->cSort);
>> }

Actually, you may construct your array as follows to make sorting with
ksort():

foreach ($query->result() as $row) {
    $arr_cTree[$row->cSort] = array[$row->cID, $row->cPcID, $row->cL,
$row->cName, $row->cSeg, $row->cSort);
}


However you do it, look at constructing your array the way you need it
to easily sort, display etc.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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