formulaire pour remplir des ticket de panne
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.

17 lines
517 B

<?php
$connect = mysqli_connect("localhost", "root", "", "ticket");
$query = "SELECT * FROM `" .$_POST['bdd'] ."`";
$title = array_keys(mysqli_fetch_assoc(mysqli_query($connect, $query)));
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=' .$_POST['bdd'] .'.csv');
$output = fopen("php://output", "w");
fputcsv($output, $title);
$result = mysqli_query($connect, $query);
while($row = mysqli_fetch_assoc($result)) {
fputcsv($output, $row);
}
fclose($output);
?>