11-19-2009, 08:13 AM
|
#3 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Posts: 170
Thanks: 18
|
Thanks tony. But; how would I make the multidimensional array from the mysql results?
I did something like this, but this works only for 2 levels.
PHP Code:
public function sort_menu ($aResult){ foreach($aResult as $aRow) { $aIds[] = $aRow[ 'id']; if (! in_array($aRow[ 'parent_id'], $aIds)) { $aCategories[ $aRow[ 'id']] = $aRow; } else { $aCategories[ $aRow[ 'parent_id']][ 'child'][] = $aRow; } } return $aCategories; }
Last edited by maZtah : 11-19-2009 at 09:34 AM.
|
|
|
|