<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech.Bitez &#187; MySQL</title>
	<atom:link href="http://www.mwasif.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mwasif.com</link>
	<description>Bits and pieces of linux, mysql, apache, php</description>
	<lastBuildDate>Sun, 20 Jun 2010 10:07:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Upgrading MySQL 4</title>
		<link>http://www.mwasif.com/2010/66/upgrading-mysql-4/</link>
		<comments>http://www.mwasif.com/2010/66/upgrading-mysql-4/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 18:00:17 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/?p=66</guid>
		<description><![CDATA[Today I found a couple of useful articles about upgrading MySQL 4. One is written by Peter Zaitsev and other by Guillaume Lefranc. 
They are talking about problems you may face while upgrading as well as benefits of MySQL 5.
I hope you guys can really benefit from it.
]]></description>
			<content:encoded><![CDATA[<p>Today I found a couple of useful articles about upgrading MySQL 4. One is written by <a href="http://www.mysqlperformanceblog.com/2010/01/05/upgrading-mysql/">Peter Zaitsev</a> and other by <a href="http://blog.adishatz.net/?p=19">Guillaume Lefranc</a>. </p>
<p>They are talking about problems you may face while upgrading as well as benefits of MySQL 5.</p>
<p>I hope you guys can really benefit from it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2010/66/upgrading-mysql-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.0.77 in RHEL 5/CentOS 5</title>
		<link>http://www.mwasif.com/2009/56/mysql-5-0-77-in-rhel-5centos-5/</link>
		<comments>http://www.mwasif.com/2009/56/mysql-5-0-77-in-rhel-5centos-5/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 18:51:10 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rhel]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/?p=56</guid>
		<description><![CDATA[Red Hat Enterprise Linux 5 and CentOS 5 are now shipping MySQL 5.0.77 instead of MySQL 5.0.45 on security grounds.]]></description>
			<content:encoded><![CDATA[<p>Red Hat Enterprise Linux 5 and CentOS 5 are now shipping MySQL 5.0.77 instead of MySQL 5.0.45 on <a href="http://dev.mysql.com/doc/refman/5.0/en/news-5-0-77.html">security grounds</a>.</p>
<p>This is moderate security release according to <a href="http://rhn.redhat.com/errata/RHSA-2009-1289.html">RHEL</a> and <a href="http://lists.centos.org/pipermail/centos-announce/2009-September/016143.html">CentOS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2009/56/mysql-5-0-77-in-rhel-5centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL for online applications &#8211; Webinar Series</title>
		<link>http://www.mwasif.com/2009/49/mysql-for-online-applications-webinar-series/</link>
		<comments>http://www.mwasif.com/2009/49/mysql-for-online-applications-webinar-series/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 20:49:10 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[mysql high availability]]></category>
		<category><![CDATA[mysql replication]]></category>
		<category><![CDATA[mysql webinars]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/?p=49</guid>
		<description><![CDATA[MySQL.com is conducting webinars on its usage in online applications.]]></description>
			<content:encoded><![CDATA[<p>MySQL.com is <a href="http://www.mysql.com/news-and-events/web-seminars/online-apps.html">conducting webinars</a> on its usage in online applications. It is a series of 5 webinars i.e.</p>
<p><strong>Part 1: Introduction to MySQL Scale Out and Replication Services</strong><br />
In the first installment we look at the basics for deploying MySQL for a scalable online application such as:</p>
<ul>
<li>Choosing the right architecture</li>
<li>Scale Out - What, Why and How?</li>
<li>Using MySQL Replication Services</li>
<li>MySQL Solutions to help manage your high-growth business</li>
</ul>
<p>North America -- Tuesday, August 18, 2009: 10:00 Pacific time / 1:00 Eastern time</p>
<p>EMEA -- Wednesday, August 26, 2009: 10:00 am European Central Time</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2009/49/mysql-for-online-applications-webinar-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Count number of words in a MySQL column</title>
		<link>http://www.mwasif.com/2008/12/count-number-of-words-in-a-mysql-column/</link>
		<comments>http://www.mwasif.com/2008/12/count-number-of-words-in-a-mysql-column/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 17:36:15 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/2008/12/count-number-of-words-in-a-mysql-column/</guid>
		<description><![CDATA[A function to count number of words in a column separated by space, comma, semicolon or any character.]]></description>
			<content:encoded><![CDATA[<p>It is a common requirement to count number of words in a column of a MySQL database table. But MySQL does not have any built in function to count number of words as it usually has for number of purposes. </p>
<p>But you can do it without it with a simple trick e.g. you have a column <em>name</em> and want to count number of words in it. This query will return number of words separated with space in a column </p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">SELECT</span> SUM<span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">LENGTH</span><span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">&#41;</span> - <span style="color: #993333; font-weight: bold;">LENGTH</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>name, <span style="color: #ff0000;">' '</span>, <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #cc66cc;">+1</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> table</pre>
<p>If you want to count number of words separated by some other string for example comma (,) or semicolon (;), simply replace <em>space</em> with your required character.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2008/12/count-number-of-words-in-a-mysql-column/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>MySQL GUI Tools</title>
		<link>http://www.mwasif.com/2008/6/mysql-gui-tools/</link>
		<comments>http://www.mwasif.com/2008/6/mysql-gui-tools/#comments</comments>
		<pubDate>Thu, 01 May 2008 10:31:45 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql front end]]></category>
		<category><![CDATA[mysql frontend]]></category>
		<category><![CDATA[MySQL gui]]></category>
		<category><![CDATA[MySQL GUIs]]></category>
		<category><![CDATA[MySQL tools]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/2008/6/mysql-gui-tools/</guid>
		<description><![CDATA[A wide variety of MySQL GUIs tools are available in the market. Most of them are free but some are paid as well. This is a list of MySQL GUI tools.]]></description>
			<content:encoded><![CDATA[<p>I am creating a list of MySQL GUI (front end) tools. I hope you will contribute this list.</p>
<p>A wide variety of MySQL GUI tools are available in the market. Most of them are free but some are paid as well. We can divide GUIs in 2 categories i.e. desktop and web based applications. Here is the list of popular MySQL GUI tools I have heard of </p>
<ol>
<li>Desktop Application
<ul>
<li><a href="http://dev.mysql.com/downloads/workbench/" rel="external nofollow">MySQL Workbench</a></li>
<li><a href="http://dev.mysql.com/downloads/gui-tools/5.0.html" rel="external nofollow">Old official MySQL GUI Tools</a> (Linux, Windows, Mac OSX)</li>
<li><a href="http://www.heidisql.com/" rel="external nofollow">HeidiSQL</a></li>
<li><a href="http://solutions.mysql.com/solutions/item.php?id=1232" rel="external nofollow">dbForge Studio</a> (requires .NET Framework 2.0, 3.0 or 3.5)</li>
<li><a href="http://www.navicat.com/" rel="external nofollow">Navicat</a> (Linux, Windows, Mac OS X)</li>
<li><a href="http://www.webyog.com/en/" rel="external nofollow">SQLyog</a></li>
<li><a href="http://cocoamysql.sourceforge.net/" rel="external nofollow">CocoaMySQL</a> (Mac OS X)</li>
<li><a href="http://www.sql-front.com/" rel="external nofollow">SQL-Front</a></li>
<li><a href="http://www.quest.com/toad-for-mysql/" rel="external nofollow">Toad for MySQL</a></li>
<li><a href="http://www.electronic-experience.net/" rel="external nofollow">ACDB sql client</a> - Supports MySQL and Oracle</li>
<li><a href="http://www.aquafold.com/" rel="external nofollow">Aqua Data Studio</a> (Linux, Windows, Mac OS X, Solaris)</li>
<li><a href="http://www.sqldeveloper.net/database-tools/mysql/overview.html" rel="external nofollow">DreamCoder</a> (Windows)</li>
<li><a href="http://www.microolap.com/products/database/mydbacentral/" rel="external nofollow">DBACentral</a> (Windows)</li>
<li>SQL Manager (http://www.sqlmanager.net/de/products/mysql/manager)</li>
<li><a href="http://www.altova.com/products/databasespy/database_tool.html" rel="external nofollow">DatabaseSpy</a></li>
</ul>
</li>
<li>Web Based Application
<ul>
<li><a href="http://www.phpmyadmin.net/" rel="external nofollow">phpMyAdmin</a></li>
<li><a href="http://www.mysqlquickadmin.com/" rel="external nofollow">MySQL Quick Admin</a></li>
<li><a href="http://mywebsql.sourceforge.net/">MyWebSQL</a></li>
</ul>
</li>
</ol>
<p>If you know any good GUI Tool, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2008/6/mysql-gui-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving images in MySQL with PHP</title>
		<link>http://www.mwasif.com/2007/4/save-image-in-mysql-with-php/</link>
		<comments>http://www.mwasif.com/2007/4/save-image-in-mysql-with-php/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 18:33:53 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php mysql image]]></category>
		<category><![CDATA[save image mysql]]></category>
		<category><![CDATA[save image php mysql]]></category>
		<category><![CDATA[save image with php]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/2007/4/save-image-in-mysql-with-php/</guid>
		<description><![CDATA[This is a short description how to save images in MySQL using PHP.]]></description>
			<content:encoded><![CDATA[<p>People have different opinions on saving images in database. Some says, "Why bother database if we can handle this by saving images to disk". I am agree with this;).</p>
<p>Most of the requirements can be fulfilled by saving the images to disk. This reduces the unnecessary load on MySQL.</p>
<p>Here is the small code to save the image in MySQL with the help of PHP.<br />
<span id="more-4"></span></p>
<p>Images are saved in MySQL as BINARY data. BINARY data can not be saved in varchar or char data types, for this purpose we need a data type which can handle binary data. <a href="http://dev.mysql.com/doc/refman/5.0/en/blob.html">BLOB</a> columns are treated as binary strings (byte strings). The following table is fulfilling our requirements for a simple test with a BLOB field.</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">CREATE TABLE</span> `images` <span style="color: #66cc66;">&#40;</span>
  `id` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> <span style="color: #aa3399; font-weight: bold;">AUTO_INCREMENT</span>,
  `image` <span style="color: #aa9933; font-weight: bold;">MEDIUMBLOB</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
  <span style="color: #993333; font-weight: bold;">PRIMARY KEY</span>  <span style="color: #66cc66;">&#40;</span>`id`<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE=MyISAM;</pre>
<p>Now we have a MySQL table ready to store the image. Next steps are easy i.e.</p>
<ol>
<li>Read the image</li>
<li>Encode the image data</li>
<li>Save binary data in DB</li>
</ol>
<p>These 3 steps are performed with the following PHP code</p>
<pre class="php"><span style="color: #0000ff;">$image</span> = <a href="http://www.php.net/chunk_split"><span style="color: #000066;">chunk_split</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/base64_encode"><span style="color: #000066;">base64_encode</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/file_get_contents"><span style="color: #000066;">file_get_contents</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;image.jpg&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$query</span> = <span style="color: #ff0000;">&quot;INSERT INTO images (image) VALUES('$image')&quot;</span>;
<a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Image id is &quot;</span>.<a href="http://www.php.net/mysql_insert_id"><span style="color: #000066;">mysql_insert_id</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>Now we have saved the image in database successfully. The next step is to display the image.</p>
<pre class="php"><span style="color: #808080; font-style: italic;">// showimage.php</span>
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Content-type: image/jpeg'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$query</span> = <span style="color: #ff0000;">&quot;SELECT image from images where id=1&quot;</span>;
<span style="color: #0000ff;">$rs</span> = <a href="http://www.php.net/mysql_fetch_array"><span style="color: #000066;">mysql_fetch_array</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/base64_decode"><span style="color: #000066;">base64_decode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;image&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>Ohhh!!! You wanted to display the image in HTML page. No problem, call this file as a image in &lt;img&gt; .e.g.</p>
<pre class="html4strict"><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></a></span>Image Test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span>
&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></a></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">&lt;h1&gt;</span></a></span>Displaying image from database<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h1&gt;</span></span>
&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;showimage.php&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></pre>
<p><a href='http://www.mwasif.com/wp-content/uploads/2007/07/multiple_files_upload.zip'>Download multiple files upload script</a></p>
<p>Let me know if you need some more info on this topic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2007/4/save-image-in-mysql-with-php/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Download data as csv using PHP</title>
		<link>http://www.mwasif.com/2007/5/download-data-csv-using-php/</link>
		<comments>http://www.mwasif.com/2007/5/download-data-csv-using-php/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 23:05:50 +0000</pubDate>
		<dc:creator>Wasif</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mwasif.com/2007/5/download-data-in-csv-format-using-php/</guid>
		<description><![CDATA[This is a very simple example to download data in csv format using PHP and MySQL. I have used a table with two columns i.e. id and name.
The main point to download file is a proper use of header(). It has said many times in many places but I repeat here, "Make sure there must [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very simple example to download data in csv format using PHP and MySQL. I have used a table with two columns i.e. id and name.</p>
<p>The main point to download file is a proper use of <a href="http://www.php.net/header">header()</a>. It has said many times in many places but I repeat here, "Make sure there must not be any sort of output (including whitespaces) before header()". We can also set a default file name for the file.</p>
<p>Here is the PHP code<br />
<span id="more-5"></span></p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #808080; font-style: italic;">// Connect to database</span>
<a href="http://www.php.net/mysql_connect"><span style="color: #000066;">mysql_connect</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;localhost&quot;</span>, <span style="color: #ff0000;">&quot;root&quot;</span>, <span style="color: #ff0000;">&quot;root&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/mysql_select_db"><span style="color: #000066;">mysql_select_db</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// mention the file name to display in download prompt</span>
<span style="color: #0000ff;">$file_name</span> = <span style="color: #ff0000;">&quot;download.csv&quot;</span>;
&nbsp;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-type: application/octet-stream&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Disposition: attachment; filename=<span style="color: #000099; font-weight: bold;">\&quot;</span>$file_name<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Cache-Control: cache, must-revalidate&quot;</span><span style="color: #66cc66;">&#41;</span>;
<a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Pragma: public&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Output header</span>
<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Id,Name&quot;</span>.<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
&nbsp;
<span style="color: #0000ff;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SELECT * FROM test&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span> = <a href="http://www.php.net/mysql_fetch_array"><span style="color: #000066;">mysql_fetch_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$result</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$rs</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;,&quot;</span>;
	<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$rs</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;name&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>Consider the followings when downloading a large csv file</p>
<ol>
<li>PHP script may exceed maximum execution time. To prevent this, use <a href="http://www.php.net/set_time_limit">set_time_limit()</a> at top of the script.</li>
<li>Sometimes it is beneficial to use <a href="http://www.php.net/mysql_unbuffered_query">mysql_unbuffered_query()</a> instead of mysql_query() for huge data.</li>
</ol>
<p>If you find any problem with this code, please inform.</p>
<p><strong>Note:</strong> Do not use "ID" in the start of CSV file. Doing so will result in an error "<a href="http://support.microsoft.com/kb/323626">SYLK: File format is not valid</a>" when opening this file in Microsoft Excel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mwasif.com/2007/5/download-data-csv-using-php/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
