<?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>Corpocrat Blog &#187; PHP Scripts</title>
	<atom:link href="http://corpocrat.com/category/php-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://corpocrat.com</link>
	<description>Daily Blog from Internet Entrepreneur/Webmaster</description>
	<lastBuildDate>Mon, 21 May 2012 21:03:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Fixing set_magic_quotes_runtime deprecated in PHP</title>
		<link>http://corpocrat.com/2012/03/19/fixing-set_magic_quotes_runtime-deprecated-in-php/</link>
		<comments>http://corpocrat.com/2012/03/19/fixing-set_magic_quotes_runtime-deprecated-in-php/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 05:58:45 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=3548</guid>
		<description><![CDATA[<p>To fix the deprecated warning causing by PHP 5.3, all you have to do is replace the</p>
set_magic_quotes_runtime(0); 
<p>with</p>


//set_magic_quotes_runtime(0);
if(version_compare(PHP_VERSION, '5.3.0', '&#60;'))
{
set_magic_quotes_runtime(0); //18th line
}

<p>I have seen this error in wordpress and vbulletin.</p>
]]></description>
			<content:encoded><![CDATA[<p>To fix the deprecated warning causing by PHP 5.3, all you have to do is replace the</p>
<pre class="brush: php; title: CODE; notranslate">set_magic_quotes_runtime(0); </pre>
<p>with</p>
<pre class="brush: php; title: CODE; notranslate">

//set_magic_quotes_runtime(0);
if(version_compare(PHP_VERSION, '5.3.0', '&lt;'))
{
set_magic_quotes_runtime(0); //18th line
}
</pre>
<p>I have seen this error in wordpress and vbulletin.</p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2012/03/19/fixing-set_magic_quotes_runtime-deprecated-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix &#8211; Deprecated: Assigning the return value of new by reference is deprecated in PHP5.3</title>
		<link>http://corpocrat.com/2012/03/16/fix-deprecated-assigning-the-return-value-of-new-by-reference-is-deprecated-in-php5/</link>
		<comments>http://corpocrat.com/2012/03/16/fix-deprecated-assigning-the-return-value-of-new-by-reference-is-deprecated-in-php5/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 11:04:24 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=3540</guid>
		<description><![CDATA[<p>i recently updated to latest PHP 5 from PHP 4 and my wordpress blog was littered with these errors. I have seen these warnings before with PHP 5. Dont worry! The fix is very easy.</p>
<p>Deprecated: Assigning the return value of new by reference is deprecated in /home/topbest/public_html/wp-settings.php on line 472</p>
<p>Deprecated: Assigning the return ...]]></description>
			<content:encoded><![CDATA[<p>i recently updated to latest PHP 5 from PHP 4 and my wordpress blog was littered with these errors. I have seen these warnings before with PHP 5. Dont worry! The fix is very easy.</p>
<blockquote><p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbest/public_html/wp-settings.php</strong> on line <strong>472</strong></p>
<p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbe/public_html/wp-settings.php</strong> on line <strong>487</strong></p>
<p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbe/public_html/wp-settings.php</strong> on line <strong>494</strong></p>
<p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbe/public_html/wp-settings.php</strong> on line <strong>530</strong></p>
<p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbe/public_html/wp-includes/cache.php</strong> on line <strong>103</strong></p>
<p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbe/public_html/wp-includes/query.php</strong> on line <strong>21</strong></p>
<p><strong>Deprecated</strong>: Assigning the return value of new by reference is deprecated in <strong>/home/topbe/public_html/wp-includes/theme.php</strong> on line <strong>623</strong></p>
<p>&nbsp;</p></blockquote>
<p>The fix is very easy. The only way you can fix this is update your wordpress to latest version or if you can manually edit the above files on lines,  <strong>remove &#8220;&amp;&#8221; </strong> fix this.</p>
<p>For Example:</p>
<pre>$wp_locale = &amp; new WP_Locale();</pre>
<p>Remove the &amp; and these warnings will be fixed.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2012/03/16/fix-deprecated-assigning-the-return-value-of-new-by-reference-is-deprecated-in-php5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto generate invoices from csv files with PHP</title>
		<link>http://corpocrat.com/2012/02/18/auto-generate-invoices-from-excel-files-with-php/</link>
		<comments>http://corpocrat.com/2012/02/18/auto-generate-invoices-from-excel-files-with-php/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 11:04:56 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[Money & Finance]]></category>
		<category><![CDATA[PHP Scripts]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=3526</guid>
		<description><![CDATA[<p>Tax season again, and i had to submit all invoices to file taxes. I always wanted a way to automatically generate invoices from the CSV file, i had which details like sales and billing activity from 2checkout.</p>
<p>I never liked buying accounting software specifically for this and i believe anything can ...]]></description>
			<content:encoded><![CDATA[<p>Tax season again, and i had to submit all invoices to file taxes. I always wanted a way to automatically generate invoices from the CSV file, i had which details like sales and billing activity from 2checkout.</p>
<p>I never liked buying accounting software specifically for this and i believe anything can be done with PHP magic code, which is why i coded myself to accomplish whatever i wanted..</p>
<p><a href="http://corpocrat.com/wp-content/uploads/2012/02/Screen-shot-2012-02-18-at-4.53.29-PM.jpg"><img class="alignnone size-medium wp-image-3532" title="Screen shot 2012-02-18 at 4.53.29 PM" src="http://corpocrat.com/wp-content/uploads/2012/02/Screen-shot-2012-02-18-at-4.53.29-PM-300x198.jpg" alt="" width="300" height="198" /></a></p>
<p>All i had to do is just parse the CSV file using <strong>fgetcsv()</strong> and echo the data on the format of the invoice. It was pretty easy and i was accomplish this within 2 hrs. You just need to put this php file and the xls file on same folder in xampp or wamp and this script will neatly print invoices for all sales activity.</p>
<blockquote><p>If you are using 2CO, just download the sales and billing activity, separated by semicolon (;). Note that this script can only parse xls file, separated by semi-colon. if you want to work for comma (,) just tweak the below code. Within this code you can uncomment lines, which is not needed. I have left as it as just to play around.</p></blockquote>
<p>Here is the code&#8230;</p>
<pre class="brush: php; title: CODE; notranslate">

&lt;?php

/* CSV First Row Array Data Format

Array ( [0] =&gt; Sale [1] =&gt; Total [2] =&gt; Date Placed
[3] =&gt; Date Shipped [4] =&gt; Name [5] =&gt; Address
[6] =&gt; City [7] =&gt; State [8] =&gt; Postal Code
[9] =&gt; Country [10] =&gt; Phone [11] =&gt; Email [12] =&gt; Ship To
[13] =&gt; Ship Address [14] =&gt; Ship City [15] =&gt; Ship State
[16] =&gt; Ship Postal Code [17] =&gt; Ship Country [18] =&gt; Date Paid
[19] =&gt; Refund [20] =&gt; Refund Date [21] =&gt; Chargeback
[22] =&gt; Chargeback Date [23] =&gt; Vendor Product ID [24] =&gt; Product Name

*/

if (($handle = fopen(&quot;test.csv&quot;, &quot;r&quot;)) !== FALSE) {
while (($data = fgetcsv($handle, 1000,'\r\n')) !== FALSE) {
$num = count($data);
//echo &quot;&lt;p&gt; $num fields in line $row: &lt;br /&gt;&lt;/p&gt;\n&quot;;
$row++;
for ($c=0; $c &lt; $num; $c++) {
echo $data[$c] . &quot;&lt;br /&gt;\n&quot;;
// use comma if you have data separated by commas in explode
$data = explode(';',$data[$c]);
//echo $data[5];

?&gt;
&lt;table width=&quot;90%&quot; height=&quot;225&quot; border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot; align=&quot;center&quot;&gt;&lt;strong&gt;I N V O I C E&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;399&quot;&gt;&lt;p&gt;&lt;strong&gt;ABC LLC&lt;/strong&gt;&lt;br /&gt;
West End Blvd #2999&lt;br /&gt;
Chicago, IL 98829&lt;br /&gt;
United States&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Company Registration No: 29204929423 &lt;br /&gt;
VAT: EX239402349&lt;/p&gt;
&lt;p&gt;Website: http://www.example.com&lt;br /&gt;
Email: email@example.com
&lt;br /&gt;
&lt;/p&gt;&lt;/td&gt;
&lt;td width=&quot;346&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;p&gt;Client / Customer: &lt;/p&gt;
&lt;p&gt; &lt;?php echo $data[4]; ?&gt;  &lt;br /&gt;
&lt;?php echo $data[5]; ?&gt;&lt;br&gt;
&lt;?php echo $data[6]; ?&gt; &lt;?php echo $data[8]; ?&gt;&lt;br&gt;
&lt;?php echo $data[7]; ?&gt;&lt;br&gt;
&lt;?php echo $data[9]; ?&gt;&lt;br&gt;
Tel: &lt;?php echo $data[10]; ?&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Invoice no: &lt;?php echo $data[0]; ?&gt; &lt;/p&gt;
&lt;p&gt;Date: &lt;?php echo $data[2]; ?&gt; &lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;&lt;table width=&quot;100%&quot; border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;th bgcolor=&quot;#caeffc&quot; scope=&quot;col&quot;&gt;Item&lt;/th&gt;
&lt;th bgcolor=&quot;#caeffc&quot; scope=&quot;col&quot;&gt;Description&lt;/th&gt;
&lt;th bgcolor=&quot;#caeffc&quot; scope=&quot;col&quot;&gt;Qty&lt;/th&gt;
&lt;th bgcolor=&quot;#caeffc&quot; scope=&quot;col&quot;&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#&lt;?php echo $data[23]; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $data[24]; ?&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;?php echo $data[1]; ?&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;Thank you for the payment.&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;Total Amount Paid: USD &lt;?php echo $data[1] ?&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;&lt;/p&gt;
&lt;?php

//print_r($data);

}
}
fclose($handle);
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2012/02/18/auto-generate-invoices-from-excel-files-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; check ssl and redirect to https secure page</title>
		<link>http://corpocrat.com/2011/11/04/php-check-ssl-and-redirect-to-https-secure-page/</link>
		<comments>http://corpocrat.com/2011/11/04/php-check-ssl-and-redirect-to-https-secure-page/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 06:03:16 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=3463</guid>
		<description><![CDATA[<p>If you have a non https form and you if you want to force to use SSL (https), it can be done with 4 lines of code with php. Remember that you need to buy ssl and have https working in your website. The key here is use of $_SERVER['https'] ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://corpocrat.com/wp-content/uploads/2011/11/Lock.png"><img class="size-full wp-image-3464 alignleft" title="Lock" src="http://corpocrat.com/wp-content/uploads/2011/11/Lock.png" alt="" width="50" height="50" /></a>If you have a non https form and you if you want to force to use SSL (https), it can be done with 4 lines of code with php. Remember that you need to buy ssl and have https working in your website. The key here is use of $_SERVER['https'] variable, which is set to a value when https is enabled in your server.</p>
<pre class="brush: php; title: CODE; notranslate">
if(empty($_SERVER[&quot;HTTPS&quot;])) {
header(&quot;Location: https://example.com/application.htm&quot;);
exit;
}
</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/11/04/php-check-ssl-and-redirect-to-https-secure-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interview with Balakrishnan who blogs at corpocrat.com</title>
		<link>http://corpocrat.com/2011/09/16/interview-with-balakrishnan-who-blogs-at-corpocrat-com/</link>
		<comments>http://corpocrat.com/2011/09/16/interview-with-balakrishnan-who-blogs-at-corpocrat-com/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 12:52:47 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[PHP Scripts]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=3373</guid>
		<description><![CDATA[<p></p>
<p>As a owner of Corpocrat.com, I was recently interviewed by SelfBlogger.com and i was really proud to share my struggles and experiences and i came a long long way to acheive my goals.  I answered on various topics including blogging, making money and career goals.  You can read my interview ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://corpocrat.com/wp-content/uploads/2011/09/Screen-shot-2011-09-16-at-6.19.29-PM.jpg"><img class="alignnone size-full wp-image-3374" title="Screen shot 2011-09-16 at 6.19.29 PM" src="http://corpocrat.com/wp-content/uploads/2011/09/Screen-shot-2011-09-16-at-6.19.29-PM.jpg" alt="" width="300" height="101" /></a></p>
<p>As a owner of Corpocrat.com, I was recently interviewed by SelfBlogger.com and i was really proud to share my struggles and experiences and i came a long long way to acheive my goals.  I answered on various topics including blogging, making money and career goals.  You can read my interview here:  <a href="http://www.selfblogger.com/2011/07/in-this-post-i-had-come-with-interview.html">http://www.selfblogger.com/2011/07/in-this-post-i-had-come-with-interview.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/09/16/interview-with-balakrishnan-who-blogs-at-corpocrat-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql Query &#8211; Use brackets for multiple conditions!</title>
		<link>http://corpocrat.com/2011/06/14/mysql-combining-or-and-and-in-where-query/</link>
		<comments>http://corpocrat.com/2011/06/14/mysql-combining-or-and-and-in-where-query/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 12:49:58 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[mysql where query]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=2943</guid>
		<description><![CDATA[<p>Often you might be in situations where you want to query your mysql database with multiple AND and OR statements in the WHERE clause., which is why i use brackets to nest either OR and AND statments. Those conditions within the brackets will be executed first in the mysql query.</p>
<p>Lets ...]]></description>
			<content:encoded><![CDATA[<p>Often you might be in situations where you want to query your mysql database with multiple AND and OR statements in the WHERE clause., which is why i use <strong>brackets</strong> to nest either OR and AND statments. Those conditions within the brackets will be <span style="text-decoration: underline;">executed first</span> in the mysql query.</p>
<p>Lets say for example,</p>
<blockquote><p>SELECT * from `pricelist` where cost &gt; 10 and color=&#8217;red&#8217; or weight &gt; 100</p></blockquote>
<p>The best way to write above query is</p>
<blockquote><p>SELECT * from `pricelist` where cost &gt; 10 and (color=&#8217;red&#8217; or weight &gt; 100)</p></blockquote>
<p>Notice from above sql statement we have used 3 conditions in the WHERE clause. Notice that our main criteria is to pick up results having cost greater than $10. This is because the condition statement within brackets get precedence and executed first.</p>
<p>It is always</p>
<p><strong>Note: Often NOT using brackets will lead to mystery results produced by mysql.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/06/14/mysql-combining-or-and-and-in-where-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10+ Best Social Network Scripts in PHP</title>
		<link>http://corpocrat.com/2011/06/02/10-top-social-network-scripts-in-php/</link>
		<comments>http://corpocrat.com/2011/06/02/10-top-social-network-scripts-in-php/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 06:31:14 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=480</guid>
		<description><![CDATA[<p></p>
<p>i have been searching for a while for  instant turnkey php scripts  to start my own social network site. I must say that i am totally impressed with the scripts and these are the best ones i have seen to start a social network. I have listed both open source ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://corpocrat.com/wp-content/uploads/2011/06/php.png"><img class="alignnone size-full wp-image-2914" title="php" src="http://corpocrat.com/wp-content/uploads/2011/06/php.png" alt="" width="200" height="106" /></a></p>
<p>i have been searching for a while for  instant turnkey php scripts  to start my own social network site. I must say that i am totally impressed with the scripts and these are the best ones i have seen to start a social network. I have listed both open source free ones and commercial ones are listed below:</p>
<h3>PHP Fox</h3>
<p><a href="http://affiliates.phpfox.com/idevaffiliate.php?id=504" target="_blank">http://www.phpfox.com</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/phpfox.png"><img class="size-full wp-image-2890 alignnone" title="phpfox" src="http://corpocrat.com/wp-content/uploads/2009/07/phpfox.png" alt="" width="266" height="88" /></a></p>
<p>phpFox is the most popular social network script written in PHP. It is a instant turnkey social network solution and is commercial.</p>
<h3>Social Engine</h3>
<p><a href="http://www.socialengine.net/?aff=olddocks" target="_blank">http://www.socialengine.net</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/socialengine.png"><img class="size-full wp-image-2891 alignnone" title="socialengine" src="http://corpocrat.com/wp-content/uploads/2009/07/socialengine.png" alt="" width="268" height="82" /></a></p>
<p>Social Engine is a feature rich, social network and community software for websites. It is commercial and comes with 100% unencrypted code.</p>
<h3>Elgg</h3>
<p><a href="http://www.elgg.org/" target="_blank">http://www.elgg.org/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/elgg.png"><img class="alignnone size-full wp-image-2892" title="elgg" src="http://corpocrat.com/wp-content/uploads/2009/07/elgg.png" alt="" width="234" height="105" /></a></p>
<p>Most powerful social networking engine written in PHP. It is available free to download.</p>
<h3>Boonex Dolphin</h3>
<p><a href="http://www.boonex.com/1295.html" target="_blank">http://boonex.com/dolphin</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/boonex.png"><img class="alignnone size-full wp-image-2893" style="margin: 20px 30px;" title="boonex" src="http://corpocrat.com/wp-content/uploads/2009/07/boonex.png" alt="" width="181" height="33" /></a></p>
<h3>Buddy Press</h3>
<p><a href="http://buddypress.org/" target="_blank">http://buddypress.org/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/buddypress.png"><img class="alignnone size-full wp-image-2894" title="buddypress" src="http://corpocrat.com/wp-content/uploads/2009/07/buddypress.png" alt="" width="288" height="81" /></a></p>
<p>Social networking platform based on WordPress MU. It is FREE to download.</p>
<h3>DZOIC</h3>
<p><a href="https://wwx.dzoic.com/aff.php?aff=027" target="_blank">http://dzoic.com/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/dzoic.png"><img class="alignnone size-full wp-image-2895" title="dzoic" src="http://corpocrat.com/wp-content/uploads/2009/07/dzoic.png" alt="" width="263" height="90" /></a></p>
<p>Dzoic Handshakes professional is a very advanced, comprehensive social network script written in PHP. It is a commercial software.</p>
<h3>Pligg</h3>
<p><a href="http://www.pligg.com" target="_blank">http://www.pligg.com</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/pligg.png"><img class="alignnone size-full wp-image-2897" title="pligg" src="http://corpocrat.com/wp-content/uploads/2009/07/pligg.png" alt="" width="299" height="97" /></a></p>
<p>Pligg is a open source social publishing and bookmarking CMS for your website. It is free script.</p>
<h3>Pointter</h3>
<p><a href="http://www.pointter.com" target="_blank">http://www.pointter.com</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/pointtter.png"><img class="alignnone size-full wp-image-2898" title="pointtter" src="http://corpocrat.com/wp-content/uploads/2009/07/pointtter.png" alt="" width="235" height="80" /></a></p>
<p>Microblogging and social network solution for Websites. It is a free software.</p>
<h3>PG Social Networking</h3>
<p><a href="http://www.datingpro.com/social/index.php?r1=affiliate&amp;r2=social" target="_blank">http://www.datingpro.com</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/datignpro.png"><img class="alignnone size-full wp-image-2900" title="datignpro" src="http://corpocrat.com/wp-content/uploads/2009/07/datignpro.png" alt="" width="190" height="112" /></a></p>
<p>Open source social network software for community websites. It is an instant turnkey social network solution and packed with advanced features. It is commercial script.</p>
<h3>WebNetwork</h3>
<p><a href="http://www.webscribble.com/products/webnetwork" target="_blank">http://www.webscribble.com/products/webnetwork</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/webnetwork1.png"><img class="alignnone size-full wp-image-2903" title="webnetwork" src="http://corpocrat.com/wp-content/uploads/2009/07/webnetwork1.png" alt="" width="234" height="55" /></a></p>
<p>Webnetwork is a social networking php script. It is commercial.</p>
<h3>MyOwnSpace</h3>
<p><a href="http://myownspace.sourceforge.net/" target="_blank">http://myownspace.sourceforge.net/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/myownspace.png"><img class="alignnone size-full wp-image-2904" title="myownspace" src="http://corpocrat.com/wp-content/uploads/2009/07/myownspace.png" alt="" width="253" height="80" /></a></p>
<p>MyOwnSpace is a free open source social network software written in PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/06/02/10-top-social-network-scripts-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>25+ Very Useful PHP Class libraries for Developers</title>
		<link>http://corpocrat.com/2011/05/07/25-very-useful-php-class-libraries-for-developers/</link>
		<comments>http://corpocrat.com/2011/05/07/25-very-useful-php-class-libraries-for-developers/#comments</comments>
		<pubDate>Sat, 07 May 2011 11:11:57 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[php class libraries]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=2357</guid>
		<description><![CDATA[<p></p>
<p>I am gonna post here some the very useful php libraries and classes which will come so handy during coding. You might run into various requirements which is why i compiled these php components.  All the php libraries listed below is free software and can be downloaded in the original ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/php.png"><img class="alignnone size-full wp-image-2826" title="php" src="http://corpocrat.com/wp-content/uploads/2011/05/php.png" alt="" width="300" height="159" /></a></p>
<p>I am gonna post here some the very useful php libraries and classes which will come so handy during coding. You might run into various requirements which is why i compiled these php components.  All the php libraries listed below is free software and can be downloaded in the original authors website.</p>
<h3>FPDF</h3>
<p><a href="http://www.fpdf.org/" target="_blank">http://www.fpdf.org/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/fpdf.png"><img class="alignnone size-full wp-image-2802" title="fpdf" src="http://corpocrat.com/wp-content/uploads/2011/05/fpdf.png" alt="" width="408" height="100" /></a></p>
<p>FDPF is a free PHP library create PDF files with pure PHP.</p>
<h3>PHP Mailer</h3>
<p><a href="http://phpmailer.codeworxtech.com/" target="_blank">http://phpmailer.codeworxtech.com/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/phpmailer.jpg"><img class="alignnone size-full wp-image-2803" title="phpmailer" src="http://corpocrat.com/wp-content/uploads/2011/05/phpmailer.jpg" alt="" width="360" height="83" /></a></p>
<p>PHP Mailer is a free class to send emails using PHP. It supports html and plain text email formats, including mail() and SMTP functions.</p>
<h3>Autosuggest  Search</h3>
<p><a href="http://woork.blogspot.com/2008/03/php-components-autosuggest.html" target="_blank">http://woork.blogspot.com/2008/03/php-components-autosuggest.html</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/autosuggest.png"><img class="alignnone size-full wp-image-2804" title="autosuggest" src="http://corpocrat.com/wp-content/uploads/2011/05/autosuggest.png" alt="" width="400" height="120" /></a></p>
<p>PHP component to implement auto suggest feature in your textbox using MySQL.</p>
<h3>ADODB Database Abstraction Library</h3>
<p><a href="http://adodb.sourceforge.net/" target="_blank"> http://adodb.sourceforge.net/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/adodb.png"><img class="alignnone size-full wp-image-2805" title="adodb" src="http://corpocrat.com/wp-content/uploads/2011/05/adodb.png" alt="" width="546" height="217" /></a></p>
<p>ADOdb is a database abstraction library for PHP designed for speed and portability. It supports number of databases including mssql, mysql, oracle, postgresql, and much more ..</p>
<h3>reCaptcha</h3>
<p><a href="http://code.google.com/apis/recaptcha/docs/php.html" target="_blank"> http://recaptcha.net/php/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/recaptcha.png"><img class="alignnone size-full wp-image-2821" title="recaptcha" src="http://corpocrat.com/wp-content/uploads/2011/05/recaptcha.png" alt="" width="313" height="128" /></a></p>
<p>Free PHP library to implement antibot captcha in your website for registrations. It is free service and works well with php.</p>
<h3>phpThumb</h3>
<p><a href="http://phpthumb.sourceforge.net/" target="_blank">http://phpthumb.sourceforge.net/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/phpthumb.jpg"><img class="alignnone size-full wp-image-2823" title="phpthumb" src="http://corpocrat.com/wp-content/uploads/2011/05/phpthumb.jpg" alt="" width="450" height="123" /></a></p>
<p>Very useful and light weight image manipulation library in PHP for generating thumbs in your website.</p>
<h3>pChart</h3>
<p><a href="http://pchart.sourceforge.net/" target="_blank"> http://pchart.sourceforge.net/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/Screen-shot-2011-05-07-at-4.36.01-PM.png"><img class="alignnone size-full wp-image-2824" title="Screen shot 2011-05-07 at 4.36.01 PM" src="http://corpocrat.com/wp-content/uploads/2011/05/Screen-shot-2011-05-07-at-4.36.01-PM.png" alt="" width="364" height="179" /></a></p>
<p>A free php chart library to create numerous varieties of charts. Charts can be constructed from sql, csv, and from database datasets</p>
<h3>Magpie RSS Parser</h3>
<p><a href="http://magpierss.sourceforge.net/" target="_blank"> http://magpierss.sourceforge.net/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/magpie.png"><img class="alignnone size-full wp-image-2806" title="magpie" src="http://corpocrat.com/wp-content/uploads/2011/05/magpie.png" alt="" width="447" height="202" /></a></p>
<p>A PHP parser to extract fields from your RSS feed. It is easy to use without any difficulties.</p>
<h3>PHP Text to Image</h3>
<p><a href="http://www.phpinsider.com/php/code/str2img/" target="_blank">http://www.phpinsider.com/php/code/str2img/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/demo.png"><img class="alignnone size-full wp-image-2807" title="demo" src="http://corpocrat.com/wp-content/uploads/2011/05/demo.png" alt="" width="316" height="208" /></a></p>
<p>A useful class which writes a text or string to an image.  Useful for hiding emails and for simple captchas. It can also output text inside an image at different angles.</p>
<h3>Smarty</h3>
<p><a href="http://www.smarty.net/" target="_blank"> http://www.smarty.net/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/smarty.gif"><img class="alignnone size-full wp-image-2808" title="smarty" src="http://corpocrat.com/wp-content/uploads/2011/05/smarty.gif" alt="" width="250" height="64" /></a></p>
<p>A very popular templating engine for PHP. It is fast, lightweight and optimized for speed.</p>
<h3>OpenID Login Authentication</h3>
<p><a href="http://openid.net/" target="_blank">http://www.openid.net</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/openid.png"><img class="alignnone size-full wp-image-2809" title="openid" src="http://corpocrat.com/wp-content/uploads/2011/05/openid.png" alt="" width="320" height="120" /></a></p>
<p>OpenID is a fastest and easiest code to implement login in your website.  This <a href="http://devzone.zend.com/article/3581">zend tutorial</a> might help for implementing openID</p>
<h3>HTML Purifier</h3>
<p><a href="http://htmlpurifier.org/" target="_blank"> http://htmlpurifier.org/</a></p>
<p>HTML purifier is an open source class for filtering mailicious and harmful XSS scripts. It is free library</p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/Screen-shot-2011-05-07-at-3.28.57-PM.png"><img class="alignnone size-full wp-image-2810" title="Screen shot 2011-05-07 at 3.28.57 PM" src="http://corpocrat.com/wp-content/uploads/2011/05/Screen-shot-2011-05-07-at-3.28.57-PM.png" alt="" width="519" height="158" /></a></p>
<h3>jQuery</h3>
<p><a href="http://jquery.com" target="_blank">http://jquery.com</a></p>
<p>jQuery is a widely popular javascript library for event handling, animated transitions and interactions. It can be easily used with php for complex interactive web applications. Please see <a href="http://jquery.hohli.com/">jquery PHP library</a> to connect php to jquery</p>
<p><a href="http://corpocrat.com/wp-content/uploads/2009/07/JQuery_logo_color_onwhite-300x741.png"><img class="alignnone size-full wp-image-1604" title="JQuery_logo_color_onwhite-300x74" src="http://corpocrat.com/wp-content/uploads/2009/07/JQuery_logo_color_onwhite-300x741.png" alt="" width="300" height="74" /></a></p>
<h3>SAJAX</h3>
<p><a href="http://www.modernmethod.com/sajax/">http://www.modernmethod.com/sajax/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/sajax.png"><img class="alignnone size-full wp-image-2812" title="sajax" src="http://corpocrat.com/wp-content/uploads/2011/05/sajax.png" alt="" width="230" height="75" /></a></p>
<p>Ajax framework for creating rich web applications. It easy to call PHP, 		Perl or Python functions from your webpages via JavaScriptYou.  Alternatively,  <a href="http://www.xajax-project.org/en/home/">xajax</a> which is as good as sajax.</p>
<h3>UPU File Uploader</h3>
<p><a href="http://sourceforge.net/projects/upu/" target="_blank">http://sourceforge.net/projects/upu/</a></p>
<p>UPU is a multiple file uploader class with progress bar. It is free software.</p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/upu.png"><img class="alignnone size-full wp-image-2813" title="upu" src="http://corpocrat.com/wp-content/uploads/2011/05/upu.png" alt="" width="415" height="180" /></a></p>
<h3>Univeral Feed Creator</h3>
<p><a href="http://www.ajaxray.com/blog/2008/03/08/php-universal-feed-generator-supports-rss-10-rss-20-and-atom/" target="_blank">http://www.ajaxray.com/blog/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/feedcre.png"><img class="alignnone size-full wp-image-2814" title="feedcre" src="http://corpocrat.com/wp-content/uploads/2011/05/feedcre.png" alt="" width="571" height="216" /></a></p>
<p>Free PHP class which generates RSS and Atom feeds. Another useful class is  <a href="http://www.bitfolge.de/index.php?option=com_content&amp;view=article&amp;id=67:feedcreator&amp;catid=38:eigene&amp;Itemid=59">Feed Creator</a> where you can quickly create RSS feed from MySQL database.</p>
<h3>phpLib</h3>
<p><a href="http://phplib.sourceforge.net/" target="_blank">http://phplib.sourceforge.net/</a></p>
<p>object-oriented application development toolkit for PHP. It is a free software for php programmers and developers.</p>
<h3>CakePHP</h3>
<p><a href="http://cakephp.org/" target="_blank">http://cakephp.org/</a></p>
<p>Rapid PHP development framework for web applications.</p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/cake.png"><img class="alignnone size-full wp-image-2816" title="cake" src="http://corpocrat.com/wp-content/uploads/2011/05/cake.png" alt="" width="180" height="180" /></a></p>
<h3>PHP Excel</h3>
<p><a href="http://phpexcel.codeplex.com/" target="_blank">http://phpexcel.codeplex.com/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/phpexcel.png"><img class="alignnone size-full wp-image-2815" title="phpexcel" src="http://corpocrat.com/wp-content/uploads/2011/05/phpexcel.png" alt="" width="361" height="103" /></a></p>
<p>Free spreadsheet engine library to read and write excel, pdf, csv and html formats.</p>
<h3>GeSHi Syntax Highlighter</h3>
<p><a href="http://qbnz.com/highlighter/" target="_blank">http://qbnz.com/highlighter/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/gesshi.png"><img class="alignnone size-full wp-image-2817" title="gesshi" src="http://corpocrat.com/wp-content/uploads/2011/05/gesshi.png" alt="" width="236" height="99" /></a></p>
<p>Geshi is a generic syntax code highlighter library supporting over 100 languages including PHP. Another alternative tool to highlight PHP code is <a href="http://www.waterproof.fr/products/phpCodeBeautifier/">phpCodeBeautifier</a></p>
<h3>phpUserClass</h3>
<p><a href="http://phpuserclass.com/" target="_blank">http://phpuserclass.com/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/phpuserclass.png"><img class="alignnone size-full wp-image-2818" title="phpuserclass" src="http://corpocrat.com/wp-content/uploads/2011/05/phpuserclass.png" alt="" width="365" height="129" /></a></p>
<p>Useful php library for user authentication and login management. It is a free open source project.</p>
<h3>PHP Math Publisher</h3>
<p>http://www.xm1math.net/phpmathpublisher/</p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/math.png"><img class="alignnone size-full wp-image-2819" title="math" src="http://corpocrat.com/wp-content/uploads/2011/05/math.png" alt="" width="302" height="81" /></a></p>
<p>PHP publishing system for publishing mathematical formulas. Each formulas are transformed into a image and it can be dynamically created. It works well in blogs, forums and with other content management applications.</p>
<h3>PHP Image Upload &amp; Crop</h3>
<p><a href="http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop-v11/" target="_blank">http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/photoup.jpg"><img class="alignnone size-full wp-image-2820" title="photoup" src="http://corpocrat.com/wp-content/uploads/2011/05/photoup.jpg" alt="" width="351" height="220" /></a></p>
<p>PHP/JQuery image upload and cropping library. It needs GD library to be installed.</p>
<h3>Smart Image Resizer</h3>
<p><a href="http://shiftingpixel.com/2008/03/03/smart-image-resizer/">http://shiftingpixel.com/2008/03/03/smart-image-resizer/</a></p>
<p><a href="http://corpocrat.com/wp-content/uploads/2011/05/imageresizer.png"><img class="alignnone size-full wp-image-2801" title="imageresizer" src="http://corpocrat.com/wp-content/uploads/2011/05/imageresizer.png" alt="" width="377" height="182" /></a></p>
<p>Easy to use php class to crop and resize images on the fly.</p>
<h3>GoogleMap API</h3>
<p><a href="http://www.phpinsider.com/php/code/GoogleMapAPI/" target="_blank">http://www.phpinsider.com/php/code/GoogleMapAPI/</a></p>
<p>A library used for creating google maps using the Google Map public  API. Features include multiple map markers, customizable icons, map  directions built into info window, and sidebar generation.</p>
<h3>IP to Country Lookup</h3>
<p><a href="http://www.eyesis.ca/projects/iplookup.html" target="_blank">http://www.eyesis.ca/projects/iplookup.html</a></p>
<p>Free php class to lookup ip address to country.</p>
<h3>PHP Code Sniffer</h3>
<p><a href="http://matrix.squiz.net/developer/tools/php_cs" target="_blank">http://matrix.squiz.net/developer/tools/php_cs</a></p>
<p>Useful library checks PHP code for programming violations and often used for testing PHP code practises.</p>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/05/07/25-very-useful-php-class-libraries-for-developers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to import text data in mysql with spaces?</title>
		<link>http://corpocrat.com/2011/01/09/how-to-import-text-data-in-mysql-with-spaces/</link>
		<comments>http://corpocrat.com/2011/01/09/how-to-import-text-data-in-mysql-with-spaces/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 14:26:23 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[import text data mysql]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=2383</guid>
		<description><![CDATA[<p></p>
<p>Lets say you have to import a large text file to mysql and fields are totally irregular but only separated by spaces. For example.  Since it is only text file and highly irregular data you have to use other methods to import data to database.</p>
<p>17876           ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://corpocrat.com/wp-content/uploads/2011/02/mysql.png"><img class="alignnone size-full wp-image-2423" title="mysql" src="http://corpocrat.com/wp-content/uploads/2011/02/mysql.png" alt="" width="200" height="103" /></a></p>
<p>Lets say you have to import a large text file to mysql and fields are totally irregular but only separated by spaces. For example.  Since it is only text file and highly irregular data you have to use other methods to import data to database.</p>
<blockquote><p>17876           BILL            hc-device          4.76                FC900888        0.88776           USD</p></blockquote>
<p>There are 3 ways to import text data into mysql</p>
<h3>1. Use a fixed width data import method</h3>
<p>Try to analyse and measure the data in text file and you will have a brief idea on length of fields.</p>
<pre>LOAD DATA LOCAL
INFILE '&lt;file name&gt;' INTO TABLE &lt;table&gt;
(@var1)
SET
 `name`=SUBSTR(@var1,1,25),
 `address`=SUBSTR(@var1,26,25),
 `zip`=SUBSTR(@var1,51,10),
 `phone`=SUBSTR(@var1,61,10)
IGNORE 35 LINES</pre>
<h3>2.  MySQL Load Data INFILE method</h3>
<p>Usually mysql does not interpret multiple spaces as one, you have to group all spaces first using sed command line, then you can import using load data infile.</p>
<blockquote>
<pre><code>sed 's/ \+/ /g' thefile &gt; thefile.new

</code></pre>
</blockquote>
<p>The above command groups all spaces into one and (the regular expression does it) and the resulting data is output written into new file. Once done we can feed  the new file to load data infile.</p>
<pre>
<blockquote>
<pre><code>LOAD DATA INFILE '&lt;filename&gt;' INTO TABLE &lt;table&gt;
FIELDS TERMINATED BY ' '
LINES TERMINATED BY '\n';
</code></pre>
</blockquote>
</pre>
<h3>3. Parsing a text file using PHP</h3>
<p>You can parse the text file using preg_split and matching regular expressions using php. The code below will separate columns separated by spaces.</p>
<pre class="brush: php; title: CODE; notranslate">

&lt;?php

$fileHandle= @fopen(&quot;data.txt&quot;, &quot;r&quot;);
if ($fileHandle) {
 while (!feof($fileHandle)) {
 $i++;
 $lines = fgets($fileHandle, 4096);

 $columns = preg_split(&quot;/\s+/&quot;, $lines);
 if(preg_match('/[0-9]+/', $columns[1])) {
 echo $columns[0] . '---&gt; '. $columns[1] . ' = '. $columns[2] . $columns[3] . $columns[4] .'&lt;br&gt;';
 // Once columns isolated, you can insert into mysql

mysql_query(&quot;INSERT into &lt;table&gt; (col1,col2,col3) VALUES (columns[0], columns[1]. columns[2])&quot;) or die(mysql_error());
}

}
 fclose($fileHandle);
}

?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/01/09/how-to-import-text-data-in-mysql-with-spaces/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to use LOAD DATA INFILE to import fixed width data in MySQL</title>
		<link>http://corpocrat.com/2011/01/09/ho-to-use-load-data-infile-to-import-fixed-width-data-in-mysql/</link>
		<comments>http://corpocrat.com/2011/01/09/ho-to-use-load-data-infile-to-import-fixed-width-data-in-mysql/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 11:49:35 +0000</pubDate>
		<dc:creator>pbu</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[mysql load data]]></category>

		<guid isPermaLink="false">http://corpocrat.com/?p=2380</guid>
		<description><![CDATA[<p>It is very easy to import fixed width CSV data into your mysql database and LOAD DATA INFILE is the fastest method i have seen. If you are on shared hosting be sure you first upload the csv file to your hosting server and specify LOCAL if not you will ...]]></description>
			<content:encoded><![CDATA[<p>It is very easy to import fixed width CSV data into your mysql database and LOAD DATA INFILE is the fastest method i have seen. If you are on shared hosting be sure you first upload the csv file to your hosting server and specify LOCAL if not you will get permission denied error.</p>
<blockquote>
<pre>LOAD DATA LOCAL
INFILE '&lt;file name&gt;' INTO TABLE &lt;table&gt;
(@var1)
SET
 `name`=SUBSTR(@var1,1,25),
 `address`=SUBSTR(@var1,26,25),
 `zip`=SUBSTR(@var1,51,10),
 `phone`=SUBSTR(@var1,61,10)
IGNORE 35 LINES
</pre>
</blockquote>
<p>If you want to just update the database using latest CSV data, specify REPLACE.  The SUBSTR() function extracts the data and it accepts first variable, then position starting from and then no of characters to extract. If you want to skip useless data in first 35 lines, you can specify IGNORE 35 lines at the bottom.</p>
<blockquote>
<pre>
LOAD DATA LOCAL
INFILE '&lt;file name&gt;'
REPLACE INTO TABLE &lt;table&gt;
(@var1)
SET `name`=SUBSTR(@var1,1,25), `address`=SUBSTR(@var1,26,25),
`zip`=SUBSTR(@var1,51,10), `phone`=SUBSTR(@var1,61,10)
IGNORE 35 LINES</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://corpocrat.com/2011/01/09/ho-to-use-load-data-infile-to-import-fixed-width-data-in-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

