Hi,
WHat i want to achieve:
get an (1) array of all the parent_id's.
example categorie id 107 has a parent_id (96) categorie 96 has a parent (50) and 50 has a parent of (0)
This what i have sofar:
function get_all_parents($id) {
$sql = mysql_query("SELECT parent_id FROM download_categorie WHERE id = $id");
$row=mysql_fetch_array($sql);
$pid = $row["parent_id"];
$parents[] = $pid;
echo $pid;
if ($pid > 0) {
$parents[] = get_all_parents($pid);
}
return $parents;
}
The echo $pid gives me the good results: 96500 (3 parent_id's of categorie 107 = 96 50 0)
$bla = get_all_parents($categorie_id); //107
$count = count($bla);
for ($e=0; $e<$count; $e++) {
echo "parent: " . $bla[$e] ."<br>";
}
This only gives me a result of 96 and array
96500
parent: 96
parent: Array
I think this means that i get an array inside an array, right?
How can i get all the results in 1 array??
Kind regards,
Gerry