Ejemplo n.º 1
0
$db->insert('test', ['id' => 2, 'text' => "Mumintrollet", 'text2' => "Mumindalen"]);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Insert a single row into table using two arrays
//
$db->insert('test', ['id', 'text', 'text2'], [2, "Mumintrollet", "Mumindalen"]);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Insert a single row into table using one array (rest will be sent as parameters)
//
$db->insert('test', ['id', 'text', 'text2']);
echo "<pre>" . $db->getSQL() . "</pre>";
//
// Update a single row using key => value
//
$db->update('test', ['age' => 22, 'text' => "Mumintrollet", 'text2' => "Mumindalen"], "id = 2");
echo "<pre>" . $db->getSQL() . "</pre>";
//
// 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");