Du kan bare bede din MySQL-database om at dumpe den som CSV:
$file = 'D:/path/to/website/dump.sql';
// The SELECT...INTO query is unable to overwrite if the
// file already exists, so delete it beforehand:
if (is_file($file))
unlink($file);
$query = "
SELECT id, title, created -- The fields to export
INTO OUTFILE '{$file}' -- The file
FIELDS TERMINATED BY ',' -- Delimiter
OPTIONALLY ENCLOSED BY '\"' -- Quote if necessary
LINES TERMINATED BY '\n' -- End line with LF newline
FROM tbl_employee -- Table name
";
$db = new MySQLi('localhost', 'root', '', 'your_database');
$db->query($query);
// Show any errors...
if ($db->error) {
var_dump($db->error);
}