$users = $this->db->query("SELECT * FROM `users`)->rows();
$rootUser = $this->db->query("SELECT * FROM `users` WHERE id = 1")->row();
the output array is:
array(
[0] => array(
'id' => 1,
'login' => 'test1',
'parent_id' => 0
),
[1] => array(
'id' => 2,
'login' => 'test2',
'parent_id' => 1
),
[2] => array(
'id' => 3,
'login' => 'test3',
'parent_id' => 2
)
)
How can I select all the nodes starting from the root node, using php, without mysql joins beacuse they have limit as far as I know only 61 joins is allowed,
Can you explain your question little more?
Otherwise if you mean to select only root nodes, then you can use sql below:
SELECT * FROM `users` WHERE parent_id=0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.