Revision: 4516
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 27, 2007 05:46 by anupaddu
Initial Code
$query = "SELECT name, email,address FROM table name"; $result = $db->sql_query($query); $file_name = "example.csv"; header("Content-type: text/x-csv"); header("Content-Disposition: attachment; filename=$file_name"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Expires: 0"); while ($data = mysql_fetch_array($result)) { echo($data['name']); echo","; echo($data['email']); echo","; echo($data['address']); echo","; echo("\t\n"); }
Initial URL
Initial Description
when im running the program the browser forced to download the file which i convert using php code(it askng do u want to download). what i want is simply run the program and convert the file as csv and csv file has to open automatically(no need of downloading dialouge box). plz let me know the solution well in advance.
Initial Title
converting MYSQl result into csv file format
Initial Tags
Initial Language
PHP