i have this code:
$pr = $tst_db->mlm_get_parent(1); // give me the value = 4 (parent_id of id 1)
$pr1 = $tst_db->mlm_get_parent($pr); // give me the value = 7 (parent_id of id 4)
$pr2 = $tst_db->mlm_get_parent($pr1); // give me the value = 5 (parent_id of id 7)
$pr3 = $tst_db->mlm_get_parent($pr2); // give me the value = 2 (parent_id of id 5)
$pr4 = $tst_db->mlm_get_parent($pr3); // give me the value = 0 (becouse id 2 not have parent id)
echo $pr; echo $pr1; echo $pr2; echo $pr3; echo $pr4;
Its possible to make like a foreach loop
with automatic creation of ($pr(num) = $tst_db->mlm_get_parent($pr(num);)
and stop it when some $pr are equal to 0?
I need to echo too all parent_it created in this automatic loop.
This is what im expeting to have like results:
All parent_id of id 1 are: 4,7,5,2
Thanks in advance