The event occurs before updating values in database and can cancel default update statement or validate incoming values.
$conn->event->attach("beforeUpdate",handlerFunc);
Parameters handlerFunc:
Availability:
Sample:
//creates and runs own update statement using values came in request, cancels default update function myUpdate($action){ mysql_query("UPDATE Countries SET item_nm='{$action->get_value('name')}' WHERE item_id='{$action->get_id()}'"); $action->success(); } //or____________________________________________________________________________________________ //checks if value of name is empty, then cancel update. Otherwise, proceeds with default update. function myUpdate($action){ if($action->get_value("name")=="") $action->invalid(); } //or____________________________________________________________________________________________ //sets new value for name and proceeds with default update. function myUpdate($action){ $new_value = rand(0,100); $action->set_value("name",$new_value); } $conn->event->attach("beforeUpdate","myUpdate");