I want to integrate an async treeview in PHP. Now i want to know how to generate a source php file with PHP.
Now my database structure is like this:
Create table School(
id int(10) NOT NULL AUTO_INCREMENT,
name varchar(50),
primary key(id)
);
Create table Class(
id int(10) NOT NULL AUTO_INCREMENT,
name varchar(50),
school_id int(10),
primary key(id),
foreign key(school_id) reference School(id) on delete cascade
);
Student(
id int(10) NOT NULL AUTO_INCREMENT,
name varchar(50),
class_id int(10),
primary key(id),
foreign key(class_id) reference Class(id) on delete cascade
);
School -> Class -> Student
Now, i want to realize the treeview. Do you have any ideas of implementing it?
Thanks a lot.
Additional question: When i finish the treeview. If i click the items in the treeview, it will generate a result table by clicking. Do you know how to do that?
However, firstly i should finish the treeview.
So basically you need to (pseudo code):
Now obviously as you go through each loop you need to be assinging your other tree properties. then when youre all done just json_encode the array and echo it where i needs to be. At least thats how id work it. Note though, that you can probably do this without an individual query using some joins but i didnt want to get into all that – youll definitely wann explore that though if performance is at all an issue.