• Start

Languages

/

PHP

/

Methods

select

The ->select() method for the SurrealDB SDK for PHP selects all or specific records from the database.

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

Method Syntax

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

// Select a specific record from a table
$person = $db->select(new RecordId('person', 'h5wxrf2ewk8xjxosxtyc'));
$person = $db->select(new StringRecordId('person:h5wxrf2ewk8xjxosxtyc'));

This function will run the following query in the database.

SELECT * FROM $thing;

Was this page helpful?