everything seems to work in the following code as in it does download data from the table but the column names are not showing in the csv what is wrong?
$stmt = $db->prepare("select * from interviews");
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$filename = "export.csv";
$f = fopen('php://output', 'w');
header('Content-Type: text/csv');
header('Content-Disposition: attachement; filename="export.csv"');
header("Pragma: no-cache");
header("Expires: 0");
foreach ($rows as $line) {
fputcsv($f, $line);
}
fclose($f);
Thanks