<p>Generating an SQL statement from an array...</p>
<pre><code>
require_once "db.php";
$db = new db();
$sql = array(
'SELECT' => '*',
'FROM' => '`database`.`table`',
'JOIN' => '`table2',
'ON' => '`table1`.`field1` = `table2`.`field2`',
'WHERE' => array(
'`field1`' => 'value1',
'`field2`' => 'value2'),
'ORDER BY' => '`field2`',
'ASC' => null
);
echo $db->build_key_query($sql);
</code></pre>
<br />
<p>Results in:</p>
<blockquote>
<?php
require_once "db.php";
$db = new db();
$sql = array(
'SELECT' => '*',
'FROM' => '`database`.`table`',
'JOIN' => '`table2',
'ON' => '`table1`.`field1` = `table2`.`field2`',
'WHERE' => array(
'`field1`' => 'value1',
'`field2`' => 'value2'),
'ORDER BY' => '`field2`',
'ASC' => null
);
echo $db->build_key_query($sql);
?></blockquote>
|