Location: PHPKode > scripts > Ultimate DB Access Wrapper > ultimate-db-access-wrapper/example_5.php
<p>This example doesn't really show anything... what it does is show you how to undo a previous MySQL action.<br />The source of this example is...</p>
<pre><code>
require_once "db.php";
$db = new db();

// Fill in the following
$db->user = '';
$db->host = '';
$db->pass = '';
$db->dbname = '';
$tbl_name = '';

// Starting the transaction
$db->start_transaction();

$sql = array(
    'col_1' => 'val_4',
    'col_2' => 'val_3',
    'col_3' => 'val_2',
    'col_4' => 'val_1'
);

$where = array(
    'col_5' => 'val_60',
    'col_60' => 'val_5'
);

// Generating the UPDATE statement
$update = $db->build_update('table', $sql, $where);

// Carrying out the UPDATE statement
$db->set_result_resource($update);

// Undoing the last action (The UPDATE statement)
$db->rollback_action();

// Ending the transaction
$db->end_transaction();</code></pre>
<?php
require_once "db.php";
$db = new db();

// Fill in the following
$db->user = '';
$db->host = '';
$db->pass = '';
$db->dbname = '';
$tbl_name = 'test table in database';

// Starting the transaction
$db->start_transaction();

$sql = array(
    'col_1' => 'val_4',
    'col_2' => 'val_3',
    'col_3' => 'val_2',
    'col_4' => 'val_1'
);

$where = array(
    'col_5' => 'val_60',
    'col_60' => 'val_5'
);

// Generating the UPDATE statement
$update = $db->build_update('table', $sql, $where);

// Carrying out the UPDATE statement
$db->set_result_resource($update);

// Undoing the last action (The UPDATE statement)
$db->rollback_action();

// Ending the transaction
$db->end_transaction();*/
?>
Return current item: Ultimate DB Access Wrapper