CSV Downloaded To Chrome - Error: MIME Type text/csv CSV Downloaded To Chrome - Error: MIME Type text/csv google-chrome google-chrome

CSV Downloaded To Chrome - Error: MIME Type text/csv


try {    $conn = new PDO("mysql:host=$servername;dbname=db_1", $username, $password);    //set the PDO error mode to exception    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);    //echo "Connected successfully";     }catch(PDOException $e)    {      echo "Connection failed: " . $e->getMessage();    }$query = $conn->prepare("SELECT * FROM csv_filds order by id asc");$query->execute();$data = ""; while($row=$query->fetch(PDO::FETCH_BOTH)){   $data .= $row['id'].",".$row['Name'].",".$row['father_name'].",".$row['address']."\n";}header('Content-Type: application/csv');header('Content-Disposition: attachment; filename="csvfile.csv"');echo $data; exit();


header("content-type: application/force-download");


header("Expires: 0");

header("Cache-control: private");