Select
1 2 3 4 5 6 7 |
$result = $db->select("SELECT * FROM targets WHERE name = ? and age = ?", array($_POST['item1'], $_POST['item2'])); foreach ($result as $row) { $myname = $row['name']; $myage = $row['age']; } |
Insert
1 2 3 |
$db->insert("INSERT INTO table1 (name,email,telephone) VALUES (?, ?, ?)", array($name, $email, $telephone)); |
Update
1 2 3 |
$db->update("UPDATE table1 SET token = ? WHERE email = ?", array($myvar, $myemail)); |
Delete
1 2 3 |
$db->delete("DELETE FROM table1 WHERE id = ?", array($myvar)); |
Get one result + Sum function
1 2 3 4 |
$result = current($db->select("SELECT sum(clicks) FROM table1 WHERE date = ? ", array($thisday))); echo $totalclicks = current($result); |