Location: PHPKode > scripts > Ultimate DB Access Wrapper > ultimate-db-access-wrapper/example_1.php
<p>Creating the INSERT and UPDATE statements... Code used to generate them are...</p>
<pre><code>
require_once "db.php";
$db = new db();

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


$insert = $db->build_insert('table', $sql);

$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'
);

$update = $db->build_update('table', $sql, $where);

echo &lt;&lt;&lt;EOT
$insert
&lt;br />
&lt;br />
$update
EOT;
</code></pre>
<br />
<p>Results in:</p>
<blockquote>
<?php
require_once "db.php";
$db = new db();

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


$insert = $db->build_insert('table', $sql);

$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'
);

$update = $db->build_update('table', $sql, $where);

echo <<<EOT
$insert
<br />
<br />
$update
EOT;

?></blockquote>
Return current item: Ultimate DB Access Wrapper