importSQL (function)

Last updated: Mon, Apr 17, 2023 10:21 am
Return to Knowledgebase

Purpose

Imports a SQL file into the database.

Location

users/helpers/us_helpers.php

Parameters

# Parameter Data Type Required Description
1 $file string Yes a string representing the file path of the SQL file to be imported

Returns

Data Type Description of Returned Data
nothing

Further Documentation:

The function reads the contents of the SQL file and executes each query one by one. The queries should be separated by a semicolon (;) at the end of each line. Comments starting with -- are ignored.

Example usage:

importSQL('path/to/sql/file.sql');

Note: Before importing a SQL file, make sure to back up your database in case anything goes wrong during the import process.