I want to import my local database dump to server phpmyadmin.For that first i export whole database dump as db-backup-2016-09-14 14.25.11.sql file.after tht i tried to import this sql file to my server phpmyadmin.Below is my code
<?php
date_default_timezone_set('Asia/Kolkata');
$date = date("Y-m-d");
$time = date("Y-m-d H:i:s");
import_tables();
function import_tables()
{
$filename = 'db-backup-2016-09-14 14.25.11.sql';
$mysql_host = '192.168.1.1';
$mysql_username = 'databaseuser';
$mysql_password = 'databasepassword';
$mysql_database = 'databasename';
$conn=mysqli_connect($mysql_host, $mysql_username, $mysql_password,$mysql_database) or die('Error connecting to MySQL server: ' . mysqli_error($conn));
mysqli_select_db($conn,$mysql_database) or die('Error selecting MySQL database: ' . mysqli_error($conn));
$templine = '';
$lines = file($filename);
foreach ($lines as $line)
{
if (substr($line, 0, 2) == '--' || $line == '')
continue;
$templine .= $line;
if (substr(trim($line), -1, 1) == ';')
{
mysqli_query($conn,$templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysqli_error($conn) . '<br /><br />');
$templine = '';
}
}
echo "Tables imported successfully";
}
?>
Here the hostname declared is my server IP address and username password which i given in mysql database username password created in server.For this im getting error like
Problem with the connection to server.If anybody knows solution please help me to get out of this problem.Thanks in advance