Trigger other operation Perform other operation like Insert/Update data in other table directly (added in version 2.4)

Many times, you want to perform insert/update/delete operation in other table than main table also. For example, after entering employee leave date in "leaves" table, you might want to update total leaves taken by that employee in employee table also. One way is to do this is using the callback function, but you have to write quite a lines of code there. Now same thing can be achieved using the setTriggerOperation() function. You can specify tablename, column data, where data, type of operation and event to perform this operation.

  
                                     $pdocrud = new PDOCrud();
                $pdocrud->setTriggerOperation("student", array("total_attendance" => array("type" => "fixed", "val" => 10)), 
                         array(), "insert", "after_insert");
//                $pdocrud->setTriggerOperation("student", array("total_attendance" => array("type" => "last_insert_id")), 
//                          array(), "insert", "after_insert");
//                $pdocrud->setTriggerOperation("student", array("total_attendance" => array("type" => "array_data", "val" => "student_id")), 
//                          array(), "insert", "before_insert");
//                $pdocrud->setTriggerOperation("student", array("total_attendance" => array("type" => "fixed", "val" => 12)), 
//                          array("student_id"=> array("type" => "array_data", "val" => "student_id")), "update", "after_update");
                echo $pdocrud->dbTable("attendance")->render();
                                

Deprecated: Optional parameter $op declared before required parameter $task is implicitly treated as a required parameter in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Creation of dynamic property PDOCrud::$langData is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 2075

Deprecated: Optional parameter $page declared before required parameter $totalrecords is implicitly treated as a required parameter in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrudHelper.php on line 191

Deprecated: Creation of dynamic property PDOModel::$characterSet is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOModel.php on line 117

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOModel.php on line 964

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOModel.php on line 964

Deprecated: Creation of dynamic property PDOModel::$characterSet is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOModel.php on line 117

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOModel.php on line 964

Deprecated: Creation of dynamic property PDOCrud::$dataHTML is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 2139

Deprecated: Creation of dynamic property PDOCrud::$fieldList is deprecated in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 2140

Attendance

Showing 1 to 2 of 2 entries

# Attendance id Status Student id Date Actions
1 3 2 1 2021-11-16
2 4 446 434 2021-11-16
# Attendance id Status Student id Date Actions