Multi table relation in tabs (nested tables) of view Editing of related records in other table (Added in v 2.6)

PDOCrud allows the editing of related records of different table i.e. similar to nested table. Nested Table is a table inside a table. It is not stored in that way but similar concept is used. You can define relation between the two tables data using some binding column value.Please note that main tables must have fields present that are used for where condition to bind records. You need to enable $config["viewFormTabs"] = true; to make this work

  
                                //student table object
                                $pStudent = new PDOCrud();
                                $pStudent->setSettings("viewFormTabs", true);
                                $pStudent->multiTableRelationDisplay("tab", "Student");
                                //student's class object
                                $pStudentClass = new PDOCrud(true);
                                $pStudentClass->dbTable("class");

                                //first paramater is first table(object) columnn name and 2nd parameter is 2nd object column name
                                $pStudent->multiTableRelation("class_id", "class_id", $pStudentClass);
                                $pStudentClass->multiTableRelationDisplay("tab", "Class");

                                //student's class object - adding one more table 
                                $pStudentTransport = new PDOCrud(true);
                                $pStudentTransport->dbTable("vehicle");

                                //first paramater is first table(object) columnn name and 2nd parameter is 2nd object column name
                                $pStudent->multiTableRelation("transport_id", "vehicle_id", $pStudentTransport);
                                $pStudentTransport->multiTableRelationDisplay("tab", "Vehicle");
                                $pStudentTransport->setSettings("viewFormTabs", true);
                                //2nd level of nesting  - relating section to class(first student to class and then class to section)
                                $pStudentSection = new PDOCrud(true);
                                $pStudentSection->dbTable("section");

                                //first paramater is first table(object) columnn name and 2nd parameter is 2nd object column name
                                $pStudentClass->multiTableRelation("class_id", "class_id", $pStudentSection);
                                $pStudentSection->multiTableRelationDisplay("tab", "Section");

                                echo $pStudent->dbTable("student")->render();
                        

Student

Showing 1 to 10 of 10 entries

# Student id Register number Joining date First name Middle name Last name Gender Date of birth Email Phone Present address Permanent address Pin code City State Country Blood group Birth place Nationality Roll number Mother tongue Category id Religion Previous school Previous school address Previous qualification Class id Section id Transport id User id Password Login status Session id Actions
1 1 1 2016-10-13 Nitishassss dfs Patil female 2016-10-26 n@gmail.com 546232 indore indore 75676 indore mp india b- indore hindu 1 hindu 1 hindu hds indore 10 2 12 1 nitisha 429632e44c203d63b3fd5dbcc673d009 1 1
2 2 2 2016-11-16 vaishali yes patel 1 1992-11-16 vaishali@gmail.com 8956235698 indore kasravad 452001 indore madhya pradesh 0 a+ indore hindu 2 hindi 3 hindu kasravad public school kasravad public school nursery 2 8 1 vaishali vaishali 1
3 3 3 2016-11-16 ankit no patidar 0 2016-11-16 ankit@gmail.com 7896523569 indore indore 452001 indore madhya pradesh 0 a+ indore hindu 3 hindi 1 hindu kasravad public school apolo tower nursery 3 9 1 ankit ankit 1 1
4 4 3 2016-11-09 x x x 1 2016-11-02 n@gm.com 8529632569 x apolo tower 45665 indore madhya pradesh 1 a+ indore hindu 3 hindi 1 hindu kasravad public school apolo tower nursery 1 10 1 admin admin@ddt2016 1
5 5 8 2016-11-10 rahul fg verma 0 1995-11-10 rahul@gmail.com 56239856322 apolo tower apolo tower 45665 indore madhya pradesh 0 a+ indore hindu 3 hindi 2 hindu fd public school fd public school nursery 2 11 1 rahul rahul 1
6 6 122 2016-11-24 snehal dsa kri 1 2016-11-09 snehal@gmail.com 9632569856 indore indore 452001 indore mp 0 b+ indore hindu 0810it101041 hindi 4 hindu dsf indore sdf 4 7 1 snehal@gmail.com d1f6648a66b1e7c82e34dd142e8a0330 1
7 7 143 2016-11-24 aliya asd bhatt 1 2016-11-08 aliya@gmail.com 9632569856 indore indore 452001 indore mp 0 b+ indore hindu 0810it101042 hindi 2 hindu dsf indore sdf 4 7 2 aliya@gmail.com e3cb970693574ea75d091a6049f8a3ff 2
8 8 5236 2016-11-17 kareena kapoor khan 1 2016-11-29 kareena@gmail.com 8526356985 indore indore 452001 indore mp 0 a+ indore hindu 0810it101043 hindi 2 hindu dsf indore sdf 3 7 1 kareena@gmail.com 9efbd0268d38eb6fc0d3805890956549 1
9 9 342 2016-11-22 karishma kko kapoor 1 2016-11-22 karishma@gmail.com sa indore indoire 452001 mumbai maharashtra 0 a+ indore hindu 0810it101045 hindi 2 hindu dsf indore sdf 4 16 1 karishma@gmail.com b3af3417c0a445baa5a4816045f44c9f 1
10 10 543 2016-11-16 nn ds sdf 0 2016-11-08 nn@gmail.com 45 fdg fdg 451 fgd fdg 1 fgd f dfg 12 df 3 dfg fdg gfd fdg 4 16 1 nn@gmail.com eab71244afb687f16d8c4f5ee9d6ef0e 1
# Student id Register number Joining date First name Middle name Last name Gender Date of birth Email Phone Present address Permanent address Pin code City State Country Blood group Birth place Nationality Roll number Mother tongue Category id Religion Previous school Previous school address Previous qualification Class id Section id Transport id User id Password Login status Session id Actions