作者:风流逍遥快活_936 | 来源:互联网 | 2017-05-12 15:07
MuSQL以文件形式导入导出整个数据库 :lt;?php /* 导出 SELECT * INTO OUTFILE
MuSQL以文件形式导入导出整个数据库 :';
}else{
echo 'Not insert into table '.$row[0].'
';
}
}
echo "The task is finished";
}else{
if (is_writable(DIR)) {
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$fileName=DIR.$row[0].".txt";
if(file_exists($fileName)){
unlink($fileName);
}
$querySql = "SELECT * INTO OUTFILE '".$fileName."'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\''
LINES TERMINATED BY '\n'
FROM `".$row[0]."`";
mysql_query($querySql) or
die("Could not dump table: ". $querySql . mysql_error());
echo 'dump table '.$row[0].' success.
';
}
echo "The task is finished";
}else{
echo 'Folder '.DIR.' can not writeable';
}
}
mysql_free_result($result);
mysql_close();
?>
,