2009-07-03 09:16:50 +00:00
|
|
|
<?php
|
2009-08-25 13:56:37 +00:00
|
|
|
function dump_table($table) {
|
2009-10-02 12:31:28 +00:00
|
|
|
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
|
2009-07-03 09:16:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function dump_data($table, $style, $select = "") {
|
2009-09-22 10:51:40 +00:00
|
|
|
global $connection;
|
2009-10-02 12:21:55 +00:00
|
|
|
$result = $connection->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT
|
2009-07-03 09:16:50 +00:00
|
|
|
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");
|
2009-09-01 13:05:50 +00:00
|
|
|
session_write_close();
|
2009-07-03 09:16:50 +00:00
|
|
|
return $ext;
|
|
|
|
}
|