HTML_TreeMenu, mysql, array and Tree.php from R. Heyes

From: Date: Tue, 09 Nov 2004 20:42:45 +0000
Subject: HTML_TreeMenu, mysql, array and Tree.php from R. Heyes
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15410@lists.php.net to get a copy of this message
Hello, i would like use the HTML_TreeMenu to create a dynamic menu Problem i have all datas in a mysql-db about 25000 (ebay-categories) all rows have id's and parend_id's, names .... i think i have to use at the first step the tree.php class from Richard Heyes to create an array with the datas from the mysql-db
(    http://www.phpguru.org/  and there the Tree2 )
// code $params = array('host' => 'localhost', 'user' => myuser, 'pass' => 'mypass, 'database' => mydb, 'query' => 'select CategoryId as id,CategoryParentId as parent_id, CategoryName as label from Categories where SiteId=0 order by parent_id,id'); $tree = &Tree::createFromMySQLI($params); (Note: i use mysqli i have added a mysqli-method in the tree.php class this do the same ) I have test it and the array is created the second step i think i have to use the HTML_TreeMenu (i have all installed new from pear) if i send the array to HTML_TreeMenu with $treeMenu = &HTML_TreeMenu::createFromStructure($tree); comes the following error Fatal error: Cannot use object of type Tree as array in /usr/local_2/lib/php/HTML/TreeMenu.php on line 116 need a object but i have only an array :-) could any help thank's a lot best regards Achim

« previous php.pear.general (#15410) next »