Web Analytics
 cara import Sql Via PHP

cara import Sql Via PHP


<?php

$conn = new mysqli('localhost', 'root', '', 'e-sembako_offline');

 

$query = '';

$sqlScript = file('database_backup.sql');

foreach ($sqlScript as $line) {

 

    $startWith = substr(trim($line), 0, 2);

    $endWith = substr(trim($line), -1, 1);

 

    if (empty($line) || $startWith == '--' || $startWith == '/*' || $startWith == '//') {

        continue;

    }

 

    $query = $query . $line;

    if ($endWith == ';') {

        mysqli_query($conn, $query) or die('<div class="error-response sql-import-response">Problem in executing the SQL query <b>' . $query . '</b></div>');

        $query = '';

    }

}

echo '<div class="success-response sql-import-response">SQL file imported successfully</div>';


Lanjut Part : 1
Jam : 03:35:48
Durasi Part : 0:0:1
Durasi Total : 0:0:1

Punya Pertanyaan , Silahkan Whatsapp Langsung
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1
Theme Customizer

Theme Styles