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();
                        

Deprecated: Required parameter $field follows optional parameter $op in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Required parameter $task follows optional parameter $op in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Required parameter $totalrecords follows optional parameter $page in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrudHelper.php on line 191

Student

Showing 1 to 5 of 12 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 2 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 1 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 3 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 4 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 1 1 rahul rahul 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