I realise its a while since the last post but i got it working fairly easily.
I replaced -
"$query = "
select
*
from
categories
order by
cat_id
";
$result = $db->sql_query($query);
while($category = $db->sql_fetchrow($result))
{
"
with -
"$query = "
select
*
from
categories
order by
cat_id
";
$result = mysql_query($query);
while($category = @mysql_fetch_assoc($result))
{
"
My db connection is as follows;
"$dbhost = "";
$dbuname = "";
$dbpword = "";
$dbname = "";
$client_flags = 128;
$dbconnection = mysql_connect($dbhost, $dbuname, $dbpword, FALSE, $client_flags) or die("Connection Failure to Database");
mysql_select_db($dbname, $dbconnection) or die ("Database not found.");
"
I can then print_r on both arrays an get the following
print_r($cat_list);
with my sample data outputs:
Array ( [0] => category_item Object ( [cat_id] => 32 [depth] => 0 [cat_title] => Home Page (sample) [cat_parent_id] => 0 [cat_long_title] => Home Page (sample) ) [1] => category_item Object ( [cat_id] => 33 [depth] => 1 [cat_title] => test [cat_parent_id] => 32 [cat_long_title] => Home Page (sample) > test ) [2] => category_item Object ( [cat_id] => 34 [depth] => 0 [cat_title] => test2 [cat_parent_id] => 0 [cat_long_title] => test2 ) )
and print_r($cat_tree);
with my sample data outputs:
Array ( [32] => Array ( [cat_id] => 32 [cat_parent_id] => 0 [cat_title] => Home Page (sample) [home] => 0 [children] => Array ( [33] => Array ( [cat_id] => 33 [cat_parent_id] => 32 [cat_title] => test [home] => 0 [children] => Array ( ) ) ) ) [34] => Array ( [cat_id] => 34 [cat_parent_id] => 0 [cat_title] => test2 [home] => 0 [children] => Array ( ) ) )
What id like to know is how can I translate this into an