phpMyEdit Triggers
See the official documentation for information on Triggers.
/*
Variables available within a trigger include:
$this - object reference
$this->dbh - nitialized MySQL database handle
$this->key - primary key name
$this->key_type - primary key type
$this->key_delim - primary key deliminator
$this->rec - primary key value (update and delete only)
$newvals - associative array of new values (update and insert only)
$oldvals - associative array of old values (update and delete only)
$changed - array of keys with changed values
*/
// Instead of deleting the record, change the status of the 'deleted' column to 1
$query2 = sprintf('UPDATE %s SET `deleted` = "1" WHERE `%s` = "%d"', $this->tb, $this->key, $this->rec);
// die($query2);
if($this->MyQuery($query2)){
return false;
}else{
echo "n".'<p>'.mysql_error().'</p>';
echo "n".'<a href="javascript:history.go(-1)" onmouseover="self.status=document.referrer;return true">Go Back</a>';
require_once('./inc/footer.php');
exit;
}
Switch to View mode after adding a new record to the table.
$opts['triggers']['insert']['after'] = './triggers/view_rec_after_add.php'; // in the form
// contents of view_rec_after_add.php
if($_POST['PME_sys_saveadd'] == 'Save' || $_POST['PME_sys_savechange'] == 'Save'){
$PME_sys_operation = 'PME_op_View';
$PME_sys_rec = $_POST['PME_sys_rec'];
$mfg_label_list_rec = 'View';
$this->operation = $mfg_label_list_rec;
}
PHP Form Generator Home
| PHP Form Generator Demo
|