I cant figure it out.
I have mysql table:
id | name | sub
1 | FirstTab | 0
2 | SecondTab| 0
3 | ThirdTab | 0
4 | FourthTab| 1
5 | FifthTab | 1
6 | SixthTab | 2
And I want to see tree like this:
- FirstTab
-- FourthTab
-- FifthTab
- SecondTab
-- SixthTab
- ThirdTab
So I got
$sth = $this->db->prepare('SELECT ...');
$sth->execute();
$sth->fetchAll();
And how I can make tree from $sth? Foreach doesnt help 🙁
Im learned more about PDO and solved my problem.