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