<?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 Blog &#187; php</title>
	<atom:link href="http://informationideas.com/news/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://informationideas.com/news</link>
	<description>Using technology to help your business</description>
	<lastBuildDate>Tue, 06 Dec 2011 06:39:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Update Delayed on Mysql and PHP</title>
		<link>http://informationideas.com/news/2008/12/11/update-delayed-on-mysql-and-php/</link>
		<comments>http://informationideas.com/news/2008/12/11/update-delayed-on-mysql-and-php/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 23:10:12 +0000</pubDate>
		<dc:creator>frank</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[update delayed]]></category>

		<guid isPermaLink="false">http://informationideas.com/news/?p=68</guid>
		<description><![CDATA[Wouldn't it be nice if we could use UPDATE DELAYED in mysql just like we do use INSERT DELAYED? Unfortunately, the work around mysql created for this is to insert a record into the events table in order to separate UPDATE statement into another thread. There is a large overhead to inserting to then execute [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><p>Wouldn't it be nice if we could use UPDATE DELAYED in mysql just like we do use INSERT DELAYED?  Unfortunately, the work around mysql created for this is to insert a record into the events table in order to separate UPDATE statement into another thread.  There is a large overhead to inserting to then execute an update.</p>
<p>If you are using PHP with mysql, there is another work around.Â  PHP has a function called, register_shutdown_function, which will execute a function during the shutdown of processing a script file.  So if we add an UPDATE LOW_PRIORITY sql statement wrapped in a function that is passed to register_shutdown_function, we can allow the user to receive the page without delay while the UPDATE statement waits until all locks on the table has been release before proceeding.<br />
<code><br />
function update_delayed()<br />
{<br />
    $sql = "UPDATE LOW_PRIORITY table_name SET col1 = 'something'";<br />
    mysql_query($sql, $conn);<br />
}</p>
<p>register_shutdown_function('update_delayed');<br />
</code></p>
<p>I wonder if there are even better ways to handle this problem.</p>
<div class="shr-publisher-68"></div><!-- Start Shareaholic LikeButtonSetBottom --><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://informationideas.com/news/2008/12/11/update-delayed-on-mysql-and-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>php strip_tags problem</title>
		<link>http://informationideas.com/news/2008/05/19/php-strip_tags-problem/</link>
		<comments>http://informationideas.com/news/2008/05/19/php-strip_tags-problem/#comments</comments>
		<pubDate>Mon, 19 May 2008 17:34:45 +0000</pubDate>
		<dc:creator>frank</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[strip_tags]]></category>

		<guid isPermaLink="false">http://informationideas.com/news/2008/05/19/php-strip_tags-problem/</guid>
		<description><![CDATA[I found that using php function, strip_tags, does not remove all the markup elements correctly from the subject content.Â  First of all, if an anchor link includes a line break, it will not be removed correctly.Â  Also, the style information is not properly removed as well.Â  In the following script, I also added in the [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop --><!-- End Shareaholic LikeButtonSetTop --><p>I found that using php function, strip_tags, does not remove all the markup elements correctly from the subject content.Â  First of all, if an anchor link includes a line break, it will not be removed correctly.Â  Also, the style information is not properly removed as well.Â  In the following script, I also added in the regex to remove any content in between script tags, but that may or may not be necessary.</p>
<p>function strip_all_tags($content)<br />
{<br />
$content = preg_replace('/\n/',' ',$content);<br />
$content = preg_replace('/&lt;script.*&lt;\/script&gt;/U',' ',$content);<br />
$content = preg_replace('/&lt;style.*&lt;\/style&gt;/U',' ',$content);<br />
$content = strip_tags(strtolower($content));<br />
return $content;<br />
}</p>
<p>The function will remove all line breaks so strip_tags will not have problems with finding all markups.Â  Since strip_tags does not remove &lt;style&gt; tags, the new function will remove them using regex.</p>
<div class="shr-publisher-51"></div><!-- Start Shareaholic LikeButtonSetBottom --><!-- End Shareaholic LikeButtonSetBottom -->]]></content:encoded>
			<wfw:commentRss>http://informationideas.com/news/2008/05/19/php-strip_tags-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.500 seconds -->

