Search the docs
Languages
/
PHP
Methods
The upsert method in the SurrealDB PHP SDK allows you to create or update a record in a table.
Creates or updates a record in a table.
Method Syntax
$db->upsert($thing, $data);
$thing
RecordId
StringRecordId
string
$data
mixed
Example
$id = new RecordId('users', 'tobie');// Upsert a record to the "users" collection.$response = $db->upsert($id, [ 'firstname' => 'Tobie', 'lastname' => 'Hitchcock',]);
Was this page helpful?
Previous
update
Next
use