SurrealDB Docs Logo

Enter a search query

->queryRaw()

With queryRaw, you will get back the raw RPC response. This contrast to the .query() method, this will not throw for errors that occur in individual queries, but will rather give those back as a string, and this will include the time it took to execute the individual queries.

Method Syntax
$db->queryRaw($query, $params);

Arguments

ArgumentsTypeDescription
$query requiredstring

The query to execute

$params optionalassociative array

An associative array of parameters to bind to the query.

Example

Example
// Query the database for all users with the firstname "Tobie" with parameters. $response = $db->queryRaw( 'SELECT * FROM users WHERE firstname = $firstname', ['firstname' => 'Tobie'] ); // Query the database for all users with the firstname "Tobie" without parameters. $response = $db->queryRaw('SELECT * FROM users WHERE firstname = "Tobie"');