Esempio n. 1
0
//
// Update a single row using two arrays
//
$db->update('test', ['age', 'text', 'text1'], [22, "Mumintrollet", "Mumindalen"], "id = 2");
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Update a single row into table using one array (rest will be sent as parameters)
//
$db->update('test', ['age', 'text', 'text1'], "id = ?");
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Select from database
//
$db->select("age, text, text1")->from('test')->where("id = 2");
echo "<pre>" . $db->getSQL() . "</pre>";
$db->orderBy("id ASC");
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Select and join from database
//
$db->select("t1.*, t2.*")->from('test AS t1')->join('test AS t2', 't1.id = t2.id');
echo "<pre>" . $db->getSQL() . "</pre>";
$db->select("t1.*, t2.*, t3.*")->from('test AS t1')->join('test AS t2', 't1.id = t2.id')->join('test AS t3', 't1.id = t3.id');
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Select, limit and offset
//
$db->select("*")->from('test')->limit('1');
echo "<pre>" . $db->getSQL() . "</pre>";
$db->select("*")->from('test')->limit('2');
echo "<pre>" . $db->getSQL() . "</pre>";