How can I streamline the process of creating and executing SQL files from PHP scripts for database integration?

To streamline the process of creating and executing SQL files from PHP scripts for database integration, you can use the file_get_contents() function to read the SQL file and then execute the queries using the mysqli_query() function.

// Read the SQL file
$sql = file_get_contents('path/to/your/sql/file.sql');

// Establish a connection to the database
$connection = mysqli_connect('localhost', 'username', 'password', 'database');

// Execute the queries in the SQL file
if (mysqli_multi_query($connection, $sql)) {
    do {
        // Store and free the first result set
        if ($result = mysqli_store_result($connection)) {
            mysqli_free_result($result);
        }
    } while (mysqli_next_result($connection));
}

// Close the database connection
mysqli_close($connection);