Skip to content
Justin Campo edited this page Oct 24, 2015 · 1 revision

##Insert

insert($table, $data, $location = "default");
$insert = array(
    "FName" => "John",
    "LName" => "Doe",
    "Age" => 26,
    "Gender" => "male"
);
$c->db->insert("mytable", $insert);

##Select

select($table, $where="", $bind=array(), $fields="*", $location = "default");

$bind = array(
    ":search" => "%example%"
);
$results = $db->select("mytable", "FName LIKE :search", $bind);

##Update

update($table, $data, $where, $bind=array(), $location = "default");
$update = array(
    "Age" => 24
);
$bind = array(
    ":fname" => "John",
    ":lname" => "Doe"
);
$db->update("mytable", $update, "FName = :fname AND LName = :lname", $bind);

##Delete

delete($table, $where, $bind=array(), $location = "default");
$bind = array(
    ":lname" => "example"
)
$db->delete("mytable", "LName = :lname", $bind);

##Run Please only use this if you must, it is better to use the methods above

run($sql, $bind=array(), $location = "default");
$bind = array(
    ":lname" => "example"
)
$db->run("SELECT * FROM mytable WHERE LName = :lname", $bind);

##Count

count($table, $where="", $bind=array(), $location = "default")
$bind = array(
    ":lname" => "example"
)
$db->count("mytable", "LName = :lname", $bind);

##Location The database class lets you load multiple database connections into it (for example a master/slave configuration). This feature can be completed ignored however and you can simply allow "default" to be used.

Clone this wiki locally