<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 <<<EOT
$insert
<br />
<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>
|