Need Programming Assignment Help?

Get Help with Programming Assignment in Java, C/C++, Dot Net, PHP, Database and UML Diagrams

MySQL Dump to Database

MySQL Dump to Database

The MySQL Dump command is used to create textfile “dumps” of databases managed by MySQL.

// open the .sql file 
$fp = @fopen("mysql.sql", "r"); 
$file = fread($fp, 80000); 

$lines = explode(';', $file); // split the .sql into sepearte queries 
$cnt = count($lines); // count array elements 

// database connection string 

// loop each query and execute 
for($j=0; ($j<$cnt-1); $j ) { 
 if(!mysql_query($lines[$j])) { 
 // echo any errors 
 echo "Error on line $j of Query:<br>"; 
 echo $lines[$j]."<br><Br>"; 
// show confirmation 
echo "Done";