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 32 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 16 R0004 2019-04-01 aaaaaaaaaaaaaaa D Kale Male 2019-04-02 testemail@gmail.com 22 Lorep ipsum address Lorep ipsum address 452005 ca ca USA o+ Cal USA 100001 English 1 1 none Lorep ipsum address na 4 16 0 1 xyz 1 1
2 17 tGGRkBepnlnVxC 0000-00-00 wOmEilLJsczzABY plxWAwMjN 0000-00-00 bellrebekaou@gmail.com 0 0 0 0 0
3 18 XqRyFRxkcdHKLpl 0000-00-00 vhBViuJIqdxBD tAXWQNOePDa 0000-00-00 sherong1987@gmail.com 0 0 0 0 0
4 19 tNpZmddkJqzInJF 0000-00-00 HzvRPuBAuLrjuRp vxiXRXupcCL 0000-00-00 lakishasanchezb@gmail.com 0 0 0 0 0
5 20 1 0000-00-00 1 1 0000-00-00 df@dd.com 0 0 0 0 0
6 21 EZhVYUVKt 0000-00-00 yALrVQzBRRibo BvWIoxGON 0000-00-00 achrolcabaugh@yahoo.com 0 0 0 0 0
7 22 RPuoMideiQjw 0000-00-00 PsUPOhxMU uvLiDhStI 0000-00-00 muchxkdhrxjcphnch@yahoo.com 0 0 0 0 0
8 23 lsitJgCFXjATpEL 0000-00-00 HvPNYbWYSGoYVv lwMsTAfzs 0000-00-00 kcsaufvwpncaykpj@yahoo.com 0 0 0 0 0
9 24 dldDAWAAr 0000-00-00 iWeLGcpS ksfXdEOdAsZ 0000-00-00 eteisenblm@yahoo.com 0 0 0 0 0
10 25 yUUbkVfaeNqojy 0000-00-00 jFJxERUKRwMBg dEKrchiHttfXj 0000-00-00 wrmmwrttlkd@yahoo.com 0 0 0 0 0
# 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