2009-07-03 09:16:50 +00:00
|
|
|
<?php
|
2009-08-25 13:56:37 +00:00
|
|
|
function dump_table($table) {
|
2009-07-03 09:16:50 +00:00
|
|
|
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
|
|
|
|
}
|
|
|
|
|
|
|
|
function dump_data($table, $style, $select = "") {
|
|
|
|
global $dbh;
|
|
|
|
$result = $dbh->query(($select ? $select : "SELECT * FROM " . idf_escape($table)));
|
|
|
|
if ($result) {
|
|
|
|
while ($row = $result->fetch_assoc()) {
|
|
|
|
dump_csv($row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 13:56:37 +00:00
|
|
|
function dump_headers($identifier) {
|
2009-07-03 09:16:50 +00:00
|
|
|
$filename = (strlen($identifier) ? friendly_url($identifier) : "dump");
|
|
|
|
$ext = "csv";
|
|
|
|
header("Content-Type: text/csv; charset=utf-8");
|
|
|
|
header("Content-Disposition: attachment; filename=$filename.$ext");
|
|
|
|
return $ext;
|
|
|
|
}
|
|
|
|
|
2009-08-25 15:23:19 +00:00
|
|
|
$dump_output = "CSV";
|