How to Restore A large database Using php script in just a second ?

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


<?php





ini_set('memory_limit','128M');
$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 ( 'backup.sql', 'r' ); 
$READ = fread ( $FP, filesize ( 'backup.sql') ); 
$READ = explode ( ";\n", $READ ); 
echo "<pre>";

foreach ( $READ AS $RED ) 
{ 
	echo 'Helo' . '<br>' ;
    mysql_query ( $RED ) or die('Query not executed'); 
} 

echo 'Done'; 



?>

Hope this will help you a lot

Advertisements
Posted in PHP. 1 Comment »

One Response to “How to Restore A large database Using php script in just a second ?”

  1. Maria Vnzl Says:

    thanks so much, your script is amazing!


Speak Your Mind

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: