• Start

Languages

/

PHP

/

Methods

delete

Delete records from a table in the database using the delete method with the SurrealDB PHP SDK.

Deletes all records in a table, or a specific record, from the database.

Method Syntax

$db->delete($thing)
ArgumentsTypeDescription
thing string, RecordId or StringRecordId The table name or a RecordId to delete.
// Delete all records from a table
$db->delete('person');

// Delete a specific record from a table
$db->delete(new RecordId('person', 'h5wxrf2ewk8xjxosxtyc'));

This function will run the following query in the database.

DELETE $thing;

Was this page helpful?