->query()
Runs a set of SurrealQL statements against the database.
Method Syntax
$db->query($query, $vars)
Arguments
| Arguments | Type | Description |
|---|
$query required | string | Specifies the SurrealQL statements. |
$vars optional | associative array | Assigns variables which can be used in the query. |
Example usage
$result = db->query(
'CREATE person SET name = "John"; SELECT * FROM type::table($tb);',
[ "tb" => "person" ]
);
$created = $result[0]->result[0];
$people = $result[1]->result;