UPDATE
The methods required to update an existing row in the table in the database are given below.
UPDATE
It is written as WDB::update(arg,arg2)
You can define the table name to arg1 value, optionally to arg2 value you can define "SET" values in data type "ARRAY".
Returns the class content as the return value.
WHERE
For detailed information, check out the "Create a Query" document.
SET
It written as WDB::set(arg1)
"ARRAY" data type must be defined to arg1 value.
Sample: Array ( [field1] => 'banana' )
Returns the class content as the return value.
SAVE
It written as WDB::save()
It is called immediately after using the methods mentioned above and a request is sent to be saved in the database.
It returns the result of the operation with data type "boolean" as the return value.
Sample PHP Code
<?php
$set = [
'field1' => 'banana',
];
$operation = WDB::update("table1"); // OR WDB::updatet("table1",$set);
$operation->set($set);
$operation->where("field","=","pear");
$save = $operation->save();
if($save)
{
echo "Successful";
}
else
{
echo "Error : ".$operation->getErrorMessage();
}
?>