• Start

v1 (stable)

/

Methods

import

Import data into an existing database using the import method with the SurrealDB PHP SDK.

Imports data into a table.

Note

This method is only available on a remote database targeted with the http protocol.

Method Syntax
$db->import($content, $username, $password);

Arguments

Type

Description

content

string

The content to import.

username

string

The username to authenticate with.

password

string

The password to authenticate with.

Example
// connect and select the namespace + database that the import function will use to import the data
$db->connect('http://localhost:8080', [
	'namespace' => 'example',
	'database' => 'example',
]);

// grab file contents and import the data
$import = file_get_contents('data.surql');
$db->import($import, 'admin', 'password');

Was this page helpful?