This is the php script which help you to restore a dump of data into your database …


<?php
ini_set('memory_limit','128M'); // set memory limit here
$db = mysql_connect ( 'Your Host', 'Your Username', 'Your password' ) or die('not connected');
mysql_select_db( 'Your database', $db) or die('Not found');
$fp = fopen ( 'sql_dump.sql', 'r' );
$fetchData = fread ( $FP, filesize ( 'sql_dump.sql') );
$sqlInfo = explode ( ";\n", $fetchData); // explode dump sql as a array data

foreach ($sqlInfo AS $sqlData )
{
mysql_query ( $sqlData ) or die('Query not executed');
}

echo 'Done';
?>

Hope this will help you

Advertisements