this is the mysql query
SELECT *
FROM users AS up
JOIN users AS u ON up.id = u.parent_id
JOIN users AS uc ON u.id = uc.parent_id
WHERE up.id =16
and this is the output in the view file
<?php foreach($query->result() as $q): ?>
<?php echo $q->id; ?>
<?php endforeach; ?>
the mysql result gives 3 levels of result, but in html it outputs only 1 level, and is the last level, but i need to render it in a hierarchy
Change your query to:
Then you can access the three levels as
id1,id2andid3: