<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Backup Your MySQL Database Using&#160;PHP</title> <atom:link href="http://davidwalsh.name/backup-mysql-database-php/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/backup-mysql-database-php</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Tue, 22 May 2012 05:31:04 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Marcus</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32183</link> <dc:creator>Marcus</dc:creator> <pubDate>Mon, 14 May 2012 16:01:31 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32183</guid> <description>Sharing my improvements:
(sorry - my linefeeds got smashed-up, I am trying to improve)
I programmed a small extension to handle numeric values explicitly.
This leads to:
- better standard conformity (no quotes for numeric values)
- less file space required (removing quotes)
- speedup (skip escaping for numeric values)HowTo:
1. Create an array with all numeric types.
2. Get attribute-types for actual table, strip redundant information (in brackets).
3. Setup an array $numflag indicating numeric datatype for each attribute
4. Assign numeric values without quotes.CODE Snippets:
&lt;code&gt;//1..at the top of function
$numtypes=array(&#039;tinyint&#039;,&#039;smallint&#039;,&#039;mediumint&#039;,&#039;int&#039;,&#039;bigint&#039;,&#039;float&#039;,&#039;double&#039;,&#039;decimal&#039;,&#039;real&#039;);//2.. at the top of table-loop
$typesarr=mysql_fetch_array(mysql_query(&#039;SHOW COLUMNS FROM &#039;.$table));//3.. below 2
for($i=0; $i&lt;$num_fields; $i++) {
$acttype=trim(preg_replace(&#039;/\s*\([^)]*\)/&#039;, &#039;&#039;, $typesarr[$i][&#039;Type&#039;]));// strip brackets from type
if (is_numeric(array_search($acttype,$numtypes))){//numeric type false cannot be checked correctly
$numflag[$i]=1;}else{$numflag[$i]=0;}
}//4.. in the fields loop (innermost)
if ($numflag[$j]==1){$return.= $row[$j] ; } else{
$row[$j] = addslashes($row[$j]);
$row[$j]  = preg_replace(&quot;/\r\n/&quot;,&quot;\\r\\n&quot;,$row[$j]);
$return.= &#039;&quot;&#039;.$row[$j].&#039;&quot;&#039; ;
}
&lt;/code&gt;Thanks to David and all other Contributors
Marcus</description> <content:encoded><![CDATA[<p>Sharing my improvements:<br
/> (sorry &#8211; my linefeeds got smashed-up, I am trying to improve)<br
/> I programmed a small extension to handle numeric values explicitly.<br
/> This leads to:<br
/> - better standard conformity (no quotes for numeric values)<br
/> - less file space required (removing quotes)<br
/> - speedup (skip escaping for numeric values)</p><p>HowTo:<br
/> 1. Create an array with all numeric types.<br
/> 2. Get attribute-types for actual table, strip redundant information (in brackets).<br
/> 3. Setup an array $numflag indicating numeric datatype for each attribute<br
/> 4. Assign numeric values without quotes.</p><p>CODE Snippets:<br
/> <code></p><p>//1..at the top of function<br
/> $numtypes=array('tinyint','smallint','mediumint','int','bigint','float','double','decimal','real');</p><p>//2.. at the top of table-loop<br
/> $typesarr=mysql_fetch_array(mysql_query('SHOW COLUMNS FROM '.$table));</p><p>//3.. below 2<br
/> for($i=0; $i&lt;$num_fields; $i++) {<br
/> $acttype=trim(preg_replace('/\s*\([^)]*\)/', '', $typesarr[$i]['Type']));// strip brackets from type<br
/> if (is_numeric(array_search($acttype,$numtypes))){//numeric type false cannot be checked correctly<br
/> $numflag[$i]=1;}else{$numflag[$i]=0;}<br
/> }</p><p>//4.. in the fields loop (innermost)<br
/> if ($numflag[$j]==1){$return.= $row[$j] ; } else{<br
/> $row[$j] = addslashes($row[$j]);<br
/> $row[$j]  = preg_replace("/\r\n/","\\r\\n",$row[$j]);<br
/> $return.= '"'.$row[$j].'"' ;<br
/> }<br
/> </code></p><p>Thanks to David and all other Contributors<br
/> Marcus</p> ]]></content:encoded> </item> <item><title>By: Marcus</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32182</link> <dc:creator>Marcus</dc:creator> <pubDate>Mon, 14 May 2012 15:53:40 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32182</guid> <description>Sharing my improvements:
I programmed a small extension to handle numeric values explicitly.
This leads to:
- better standard conformity (no quotes for numeric values)
- less file space required (removing quotes)
- speedup (skip escaping for numeric values)HowTo:
1. Create an array with all numeric types.
2. Get attribute-types for actual table, strip redundant information (in brackets).
3. Setup an array $numflag indicating numeric datatype for each attribute
4. Assign numeric values without quotes.CODE Snippets:
&lt;code&gt;//1..at the top of function
$numtypes=array(&#039;tinyint&#039;,&#039;smallint&#039;,&#039;mediumint&#039;,&#039;int&#039;,&#039;bigint&#039;,&#039;float&#039;,&#039;double&#039;,&#039;decimal&#039;,&#039;real&#039;);//2.. at the top of table-loop
$typesarr=mysql_fetch_array(mysql_query(&#039;SHOW COLUMNS FROM &#039;.$table));//3.. below 2
for($i=0; $i&lt;$num_fields; $i++) {
$acttype=trim(preg_replace(&#039;/\s*\([^)]*\)/&#039;, &#039;&#039;, $typesarr[$i][&#039;Type&#039;]));// strip brackets from type
if (is_numeric(array_search($acttype,$numtypes))){//numeric type false cannot be checked correctly
$numflag[$i]=1;}else{$numflag[$i]=0;}
}//4.. in the fields loop (innermost)
if ($numflag[$j]==1){$return.= $row[$j] ; } else{
$aarr[$j] = addslashes($row[$j]);
$aarr[$j]  = preg_replace(&quot;/\r\n/&quot;,&quot;\\r\\n&quot;,$row[$j]);
$return.= &#039;&quot;&#039;.$row[$j].&#039;&quot;&#039; ;
}
&lt;/code&gt;Thanks to David and all other Contributors
Marcus</description> <content:encoded><![CDATA[<p>Sharing my improvements:<br
/> I programmed a small extension to handle numeric values explicitly.<br
/> This leads to:<br
/> - better standard conformity (no quotes for numeric values)<br
/> - less file space required (removing quotes)<br
/> - speedup (skip escaping for numeric values)</p><p>HowTo:<br
/> 1. Create an array with all numeric types.<br
/> 2. Get attribute-types for actual table, strip redundant information (in brackets).<br
/> 3. Setup an array $numflag indicating numeric datatype for each attribute<br
/> 4. Assign numeric values without quotes.</p><p>CODE Snippets:<br
/> <code></p><p>//1..at the top of function<br
/> $numtypes=array('tinyint','smallint','mediumint','int','bigint','float','double','decimal','real');</p><p>//2.. at the top of table-loop<br
/> $typesarr=mysql_fetch_array(mysql_query('SHOW COLUMNS FROM '.$table));</p><p>//3.. below 2<br
/> for($i=0; $i&lt;$num_fields; $i++) {<br
/> $acttype=trim(preg_replace(&#039;/\s*\([^)]*\)/&#039;, &#039;&#039;, $typesarr[$i][&#039;Type&#039;]));// strip brackets from type<br
/> if (is_numeric(array_search($acttype,$numtypes))){//numeric type false cannot be checked correctly<br
/> $numflag[$i]=1;}else{$numflag[$i]=0;}<br
/> }</p><p>//4.. in the fields loop (innermost)<br
/> if ($numflag[$j]==1){$return.= $row[$j] ; } else{<br
/> $aarr[$j] = addslashes($row[$j]);<br
/> $aarr[$j]  = preg_replace(&quot;/\r\n/&quot;,&quot;\\r\\n&quot;,$row[$j]);<br
/> $return.= &#039;&quot;&#039;.$row[$j].&#039;&quot;&#039; ;<br
/> }<br
/> </code></p><p>Thanks to David and all other Contributors<br
/> Marcus</p> ]]></content:encoded> </item> <item><title>By: arifhossen</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32164</link> <dc:creator>arifhossen</dc:creator> <pubDate>Sun, 13 May 2012 11:16:01 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32164</guid> <description>Thanks a lot, Great Article.</description> <content:encoded><![CDATA[<p>Thanks a lot, Great Article.</p> ]]></content:encoded> </item> <item><title>By: Ahmad Ali</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32116</link> <dc:creator>Ahmad Ali</dc:creator> <pubDate>Wed, 09 May 2012 19:58:41 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32116</guid> <description>This code is very much helpful for developers and users as wel. It helps me a lot to get backups of my mysql databases. Thanks a lot.</description> <content:encoded><![CDATA[<p>This code is very much helpful for developers and users as wel. It helps me a lot to get backups of my mysql databases. Thanks a lot.</p> ]]></content:encoded> </item> <item><title>By: Marcus</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32096</link> <dc:creator>Marcus</dc:creator> <pubDate>Wed, 09 May 2012 08:46:28 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32096</guid> <description>Thanks DavidYour script is great.
I just tested to transform your script to PDO:
It works, however SHOW CREATE TABLE seems not to accept a PDO-Parameter for TABLEThank you
Marcus</description> <content:encoded><![CDATA[<p>Thanks David</p><p>Your script is great.<br
/> I just tested to transform your script to PDO:<br
/> It works, however SHOW CREATE TABLE seems not to accept a PDO-Parameter for TABLE</p><p>Thank you<br
/> Marcus</p> ]]></content:encoded> </item> <item><title>By: Brandon</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32060</link> <dc:creator>Brandon</dc:creator> <pubDate>Mon, 07 May 2012 17:30:49 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32060</guid> <description>Great script, thanks for creating/posting this!</description> <content:encoded><![CDATA[<p>Great script, thanks for creating/posting this!</p> ]]></content:encoded> </item> <item><title>By: Ward</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-32059</link> <dc:creator>Ward</dc:creator> <pubDate>Mon, 07 May 2012 17:29:56 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-32059</guid> <description>Great time saver!  Will definitely set this up as a cron and sleep easier at night!</description> <content:encoded><![CDATA[<p>Great time saver!  Will definitely set this up as a cron and sleep easier at night!</p> ]]></content:encoded> </item> <item><title>By: blackhoot</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-31979</link> <dc:creator>blackhoot</dc:creator> <pubDate>Wed, 02 May 2012 00:37:05 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-31979</guid> <description>you&#039;re missing a bracket, and some of this doesn&#039;t make sense. Ah, shame... if only I could just use shell_exec()... blah.</description> <content:encoded><![CDATA[<p>you&#8217;re missing a bracket, and some of this doesn&#8217;t make sense. Ah, shame&#8230; if only I could just use shell_exec()&#8230; blah.</p> ]]></content:encoded> </item> <item><title>By: Kenneth Purtell</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-31884</link> <dc:creator>Kenneth Purtell</dc:creator> <pubDate>Thu, 26 Apr 2012 11:14:44 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-31884</guid> <description>Great stuff David. You got me out of a tight spot. Thanks.</description> <content:encoded><![CDATA[<p>Great stuff David. You got me out of a tight spot. Thanks.</p> ]]></content:encoded> </item> <item><title>By: Cj Belo</title><link>http://davidwalsh.name/backup-mysql-database-php#comment-31881</link> <dc:creator>Cj Belo</dc:creator> <pubDate>Thu, 26 Apr 2012 08:48:20 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=336#comment-31881</guid> <description>Hi,Is this applicable in large database like more than 1gb?Thanks,</description> <content:encoded><![CDATA[<p>Hi,</p><p>Is this applicable in large database like more than 1gb?</p><p>Thanks,</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.021 seconds using disk: basic
Object Caching 805/805 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-22 01:48:43 -->
