Checkout this small post.
Dear Sir,
Thanx for your reply.i modified your code according to my requirement but i am facing a problem with characters set i.e there are some data at database like as plate_no : 1 2 3 ص ص ص but when i exported it in csv format i see it as 1 2 2 3 س س س. so can you tell me where is my problem or how can i solve it.
[php code]
<?php
header('Content-Type: text/html; charset=utf-8');
// Connect to database
mysql_connect(" localhost", "root", "root123");
mysql_select_db ("medgulf");
// mention the file name to display in download prompt
$file_name = "download.c sv";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$fil e_name\"");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
// Output header
//echo "Name,Code"."\n ";
$result = mysql_query("SE LECT * FROM vehicle_info");
while($rs = mysql_fetch_arr ay($result))
{
echo $rs["user_name"].",";
echo $rs["entry_date "].",";
echo $rs["id_no"].",";
echo $rs["license_ty pe"].",";
echo $rs["vehicle_ty pe"].",";
echo $rs["plate_no"].",";
echo $rs["chassis_no "].",";
echo $rs["body_type"].",";
echo $rs["model_year "].",";
echo $rs["status"]."\n";
}
?>