<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Download data as csv using PHP</title>
	<atom:link href="http://www.mwasif.com/2007/5/download-data-csv-using-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/</link>
	<description>Get yourself ready for your own site</description>
	<pubDate>Fri, 29 Aug 2008 01:30:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Deepak Raikwar</title>
		<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/#comment-43</link>
		<dc:creator>Deepak Raikwar</dc:creator>
		<pubDate>Thu, 12 Jun 2008 12:45:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mwasif.com/2007/5/download-data-in-csv-format-using-php/#comment-43</guid>
		<description>Hi Everyone,
                  Thanks coz i got ur code bye ............</description>
		<content:encoded><![CDATA[<p>Hi Everyone,<br />
                  Thanks coz i got ur code bye &#8230;&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed Hosny</title>
		<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/#comment-8</link>
		<dc:creator>Ahmed Hosny</dc:creator>
		<pubDate>Fri, 14 Dec 2007 14:23:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.mwasif.com/2007/5/download-data-in-csv-format-using-php/#comment-8</guid>
		<description>sorry this one

$unicode_str_for_Excel = chr(255).chr(254).mb_convert_encoding( $utf8_str, 'UTF-16LE', 'UTF-8');</description>
		<content:encoded><![CDATA[<p>sorry this one</p>
<p>$unicode_str_for_Excel = chr(255).chr(254).mb_convert_encoding( $utf8_str, &#8216;UTF-16LE&#8217;, &#8216;UTF-8&#8242;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed Hosny</title>
		<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/#comment-7</link>
		<dc:creator>Ahmed Hosny</dc:creator>
		<pubDate>Fri, 14 Dec 2007 14:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.mwasif.com/2007/5/download-data-in-csv-format-using-php/#comment-7</guid>
		<description>Dear ,

try to put the output into var $utf8_str, and then

use this code


it will work
Best regards
Ahmed</description>
		<content:encoded><![CDATA[<p>Dear ,</p>
<p>try to put the output into var $utf8_str, and then</p>
<p>use this code</p>
<p>it will work<br />
Best regards<br />
Ahmed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wasif</title>
		<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/#comment-6</link>
		<dc:creator>Wasif</dc:creator>
		<pubDate>Tue, 11 Dec 2007 18:53:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mwasif.com/2007/5/download-data-in-csv-format-using-php/#comment-6</guid>
		<description>In notepad you can view utf8 data properly, but this is Excel which causes the problem. If you must need to view data in Excel, use an editor like SciTE or Ultraedit to save the file in unicode format and then open it in Excel.</description>
		<content:encoded><![CDATA[<p>In notepad you can view utf8 data properly, but this is Excel which causes the problem. If you must need to view data in Excel, use an editor like SciTE or Ultraedit to save the file in unicode format and then open it in Excel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: faruk chowdhury</title>
		<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/#comment-2</link>
		<dc:creator>faruk chowdhury</dc:creator>
		<pubDate>Thu, 06 Dec 2007 21:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mwasif.com/2007/5/download-data-in-csv-format-using-php/#comment-2</guid>
		<description>Dear Sir,
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]
&lt;?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.csv";

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file_name\"");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");

// Output header
//echo "Name,Code"."\n";

$result = mysql_query("SELECT * FROM vehicle_info");
while($rs = mysql_fetch_array($result))
{
echo $rs["user_name"].",";
echo $rs["entry_date"].",";
echo $rs["id_no"].",";
echo $rs["license_type"].",";
echo $rs["vehicle_type"].",";
echo $rs["plate_no"].",";
echo $rs["chassis_no"].",";
echo $rs["body_type"].",";
echo $rs["model_year"].",";
echo $rs["status"]."\n";
}
?&gt;</description>
		<content:encoded><![CDATA[<p>Dear Sir,<br />
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.<br />
[php code]<br />
< ?php<br />
header('Content-Type: text/html; charset=utf-8');<br />
// Connect to database<br />
mysql_connect("localhost", "root", "root123");<br />
mysql_select_db("medgulf");</p>
<p>// mention the file name to display in download prompt<br />
$file_name = "download.csv";</p>
<p>header("Content-type: application/octet-stream");<br />
header("Content-Disposition: attachment; filename=\"$file_name\"");<br />
header("Cache-Control: cache, must-revalidate");<br />
header("Pragma: public");</p>
<p>// Output header<br />
//echo "Name,Code"."\n";</p>
<p>$result = mysql_query("SELECT * FROM vehicle_info");<br />
while($rs = mysql_fetch_array($result))<br />
{<br />
echo $rs["user_name"].",";<br />
echo $rs["entry_date"].",";<br />
echo $rs["id_no"].",";<br />
echo $rs["license_type"].",";<br />
echo $rs["vehicle_type"].",";<br />
echo $rs["plate_no"].",";<br />
echo $rs["chassis_no"].",";<br />
echo $rs["body_type"].",";<br />
echo $rs["model_year"].",";<br />
echo $rs["status"]."\n";<br />
}<br />
?></p>
]]></content:encoded>
	</item>
</channel>
</rss>
