"; Print_r ($data);
$data _new=array ();
$tmp =array ();
foreach ($data as $line) {
$line =trim ($line);
if (strlen ($line) ==0) {
Continue
}
if (substr ($line, 0,2) = = '--') {
Continue
}
if (substr ($line, 0,2) = = '/* ') {
Continue
}
$tmp []= $line;
if (substr ($line,-1) = = '; ') {
$query =implode (' ', $tmp);
$tmp =array ();
$data _new[]= $query;
}
}
$mysqli =new mysqli (' localhost ', ' root ', ' root ', ' test ');
if ($mysqli->connect_errno) {
Exit (' Database connection failed! ');
}
$mysqli->query ("Set names UTF8");
$error =array ();
foreach ($data _new as $sql) {
$mysqli->query ($sql);
$r = $mysqli->error;
if ($r) $error []= $r;
}
Print_r ($R);
/*
Mysql>alter TABLE tbl2 DISABLE KEYS;
Query OK, 0 rows Affected (0.00 sec)
Mysql>insert to Tbl2 SELECT * from TBL1;
Query OK, 2000000 row Affected (36.30 sec)
records:2000000 duplicates:0 warnings:0
Mysql>alter TABLE tbl2 ENABLE KEYS;
Query OK, 0 rows affected (44.55 sec)
*/