You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
509 B
18 lines
509 B
<?php
|
|
$bdd = new SQLite3('../../database/ticket_panne.db', SQLITE3_OPEN_READWRITE);
|
|
$res = $bdd->query('SELECT * FROM ' .$_POST['bdd']);
|
|
|
|
header('Content-Type: text/csv; charset=utf-8');
|
|
header('Content-Disposition: attachment; filename=' .$_POST['bdd'] .'.csv');
|
|
$output = fopen("php://output", "w");
|
|
|
|
$title = $res->fetchArray(SQLITE3_ASSOC);
|
|
|
|
fputcsv($output, array_keys($title));
|
|
fputcsv($output, $title);
|
|
|
|
while($row = $res->fetchArray(SQLITE3_ASSOC)) {
|
|
fputcsv($output, $row);
|
|
}
|
|
fclose($output);
|
|
?>
|
|
|