# 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.

```php title="Method Syntax"
$db->import($content, $username, $password);
```

## Arguments

<table>
	<thead>
		<tr>
			<th colspan="2" scope="col">Arguments</th>
			<th colspan="2" scope="col">Type</th>
			<th colspan="2" scope="col">Description</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td colspan="2" scope="row" data-label="Arguments">
				<code>content</code>
				<label label="required" />
			</td>
			<td colspan="2" scope="row" data-label="Type">
				`string`
			</td>
			<td colspan="2" scope="row" data-label="Description">
				The content to import.
			</td>
		</tr>
		<tr>
			<td colspan="2" scope="row" data-label="Arguments">
				<code>username</code>
				<label label="required" />
			</td>
			<td colspan="2" scope="row" data-label="Type">
				`string`
			</td>
			<td colspan="2" scope="row" data-label="Description">
				The username to authenticate with.
			</td>
		</tr>
		<tr>
			<td colspan="2" scope="row" data-label="Arguments">
				<code>password</code>
				<label label="required" />
			</td>
			<td colspan="2" scope="row" data-label="Type">
				`string`
			</td>
			<td colspan="2" scope="row" data-label="Description">
				The password to authenticate with.
			</td>
		</tr>
	</tbody>
</table>

## Example

```php title="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');
```
