A very simple MySQL database class.
Usage:
// connect
$config = array(
'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database);
$DB = Database_MySQL::getInstance($config);
// set query
$DB->query("select * from table1 where col1 = %d and col2 = '%s' LIMIT 1", 5, 'a');
// get rows
$rows = $DB->getRowList();
// display rows
foreach($rows as $row) {
echo $row->col1 . ' : ' . $row->col2 . '<br />';
}
When creating a query, you can interpolate values into the SQL query like sprintf() does. So for example:
$DB->query("select * from table1 where col1 = %d and col2 = '%s' LIMIT 1", 5, 'a');
Would generate the SQL:
"select * from table1 where col1 = 5 and col2 = 'a' LIMIT 1"