<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Export MySQL table to Excel file using php script</title>
	<atom:link href="http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/</link>
	<description>Think Forward, not Backward</description>
	<lastBuildDate>Mon, 12 Oct 2009 16:29:15 +0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: John</title>
		<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/comment-page-1/#comment-813</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sat, 19 Sep 2009 13:53:45 +0000</pubDate>
		<guid isPermaLink="false">http://sandaldjepit.com/?p=91#comment-813</guid>
		<description>Thank you man....</description>
		<content:encoded><![CDATA[<p>Thank you man&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: atpaz</title>
		<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/comment-page-1/#comment-812</link>
		<dc:creator>atpaz</dc:creator>
		<pubDate>Sat, 19 Sep 2009 02:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://sandaldjepit.com/?p=91#comment-812</guid>
		<description>@John, 
Hi, it&#039;s simple you can edit the code at header response (line 62 - 67) with the code to write $data to file. Here is example  :

[php]

$filename = &#039;export_result.csv&#039;;
$somecontent = $data;

// Let&#039;s make sure the file exists and is writable first.
if (is_writable($filename)) {

    // In our example we&#039;re opening $filename in append mode.
    // The file pointer is at the bottom of the file hence
    // that&#039;s where $somecontent will go when we fwrite() it.
    if (!$handle = fopen($filename, &#039;a&#039;)) {
         echo &quot;Cannot open file ($filename)&quot;;
         exit;
    }

    // Write $somecontent to our opened file.
    if (fwrite($handle, $somecontent) === FALSE) {
        echo &quot;Cannot write to file ($filename)&quot;;
        exit;
    }

    echo &quot;Success, wrote ($somecontent) to file ($filename)&quot;;

    fclose($handle);

} else {
    echo &quot;The file $filename is not writable&quot;;
}

[/php]</description>
		<content:encoded><![CDATA[<p>@John,<br />
Hi, it&#8217;s simple you can edit the code at header response (line 62 &#8211; 67) with the code to write $data to file. Here is example  :</p>
<p>[php]</p>
<p>$filename = &#8216;export_result.csv&#8217;;<br />
$somecontent = $data;</p>
<p>// Let&#8217;s make sure the file exists and is writable first.<br />
if (is_writable($filename)) {</p>
<p>    // In our example we&#8217;re opening $filename in append mode.<br />
    // The file pointer is at the bottom of the file hence<br />
    // that&#8217;s where $somecontent will go when we fwrite() it.<br />
    if (!$handle = fopen($filename, &#8216;a&#8217;)) {<br />
         echo &#8220;Cannot open file ($filename)&#8221;;<br />
         exit;<br />
    }</p>
<p>    // Write $somecontent to our opened file.<br />
    if (fwrite($handle, $somecontent) === FALSE) {<br />
        echo &#8220;Cannot write to file ($filename)&#8221;;<br />
        exit;<br />
    }</p>
<p>    echo &#8220;Success, wrote ($somecontent) to file ($filename)&#8221;;</p>
<p>    fclose($handle);</p>
<p>} else {<br />
    echo &#8220;The file $filename is not writable&#8221;;<br />
}</p>
<p>[/php]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/comment-page-1/#comment-811</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 18 Sep 2009 22:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://sandaldjepit.com/?p=91#comment-811</guid>
		<description>How to save it automatically to server? not to download it?</description>
		<content:encoded><![CDATA[<p>How to save it automatically to server? not to download it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davi</title>
		<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/comment-page-1/#comment-789</link>
		<dc:creator>Davi</dc:creator>
		<pubDate>Mon, 10 Aug 2009 20:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://sandaldjepit.com/?p=91#comment-789</guid>
		<description>It really works, thanks a lot!</description>
		<content:encoded><![CDATA[<p>It really works, thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/comment-page-1/#comment-773</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Thu, 30 Jul 2009 19:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://sandaldjepit.com/?p=91#comment-773</guid>
		<description>It doesn`t works !!!!! doesn`t appear dialog box... asking for downloading file.
nevertheless Thanks.</description>
		<content:encoded><![CDATA[<p>It doesn`t works !!!!! doesn`t appear dialog box&#8230; asking for downloading file.<br />
nevertheless Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andi Haehlen</title>
		<link>http://sandaldjepit.com/2009/export-mysql-table-to-excel-file-using-php-script/comment-page-1/#comment-649</link>
		<dc:creator>Andi Haehlen</dc:creator>
		<pubDate>Thu, 30 Apr 2009 14:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://sandaldjepit.com/?p=91#comment-649</guid>
		<description>i found that the script ignores the last record fetched from the datatable (for example: from 100 records, only 99 are transferred to excel). if in line 71 $header.&quot;\n&quot; is removed, all the records show up in excel.

to make things easier, i&#039;ve simply replaced all occurences of $header with $data, so the header and the record data is filled into a single variable ($data). this works just fine.</description>
		<content:encoded><![CDATA[<p>i found that the script ignores the last record fetched from the datatable (for example: from 100 records, only 99 are transferred to excel). if in line 71 $header.&#8221;\n&#8221; is removed, all the records show up in excel.</p>
<p>to make things easier, i&#8217;ve simply replaced all occurences of $header with $data, so the header and the record data is filled into a single variable ($data). this works just fine.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
