->update()
Updates all records in a table, or a specific record, in the database.
Method Syntax
$db->update($thing, $data)
This function replaces the current document / record data with the specified data.
Arguments
| Arguments | Type | Description |
|---|
thing required | string, RecordId or StringRecordId
| The table name or the specific RecordId to update. |
data optional | mixed | The document / record data to update. |
Example usage
$people = $db->update('person');
$person = $db->update(new RecordId('person', 'tobie'), [
"name" => 'Tobie',
"settings" => [
"active" => true,
"marketing" => true,
],
]);
$record = $db->update(new RecordId('person', 'tobie'), [
"name" => 'Tobie',
]);
Translated query
This function will run the following query in the database.
UPDATE $thing CONTENT $data;