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

From: Date: Sun, 11 Mar 2012 01:12:25 +0000
Subject: Re: looking for an array sorting function.. just not sure which one..and how yet
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-316976@lists.php.net to get a copy of this message
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

« previous php.general (#316976) next »