Update
Update
The update in a table using ivory can be done using just the name of a table and an array of properties.
Example
//import the ivory class
require_once('Operations.php');
//the instance of the ivory
$ivoryOrm = new Operations();
//props is an array that contains the key that is the name of the field in the table an their value will be the value it should save in the table
$props = array();
$props["name"] = "Jon";
$props["age"] = 20;
$tableName = "users";
//the method creates the query : UPDATE users SET name = 'Jon', age = 20;
$update = $ivoryOrm->update($tableName, $props);
//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($update);
Example Using Where
//import the ivory class
require_once('Operations.php');
//the instance of the ivory
$ivoryOrm = new Operations();
//props is an array that contains the key that is the name of the field in the table an their value will be the value it should save in the table
$props = array();
$props["name"] = "Jon";
$props["age"] = 20;
$tableName = "users";
$whereUpdate[] = [
"propName" => "id",
"fieldValue" => 10,
];
//the method creates the query : UPDATE users SET name = 'Jon', age = 20 WHERE id = 10;
$update = $ivoryOrm->update($tableName, $props);
$updateWhere = $ivoryOrm->where($update, $whereUpdate);
//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($updateWhere);