<?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>Ian Dunn &#187; PHP</title>
	<atom:link href="http://iandunn.name/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://iandunn.name</link>
	<description>Seattle-based web developer blogging about tips and solutions</description>
	<lastBuildDate>Fri, 18 May 2012 18:11:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Creating Admin Notices From a WordPress Plugin</title>
		<link>http://iandunn.name/creating-admin-notices-from-a-wordpress-plugin/</link>
		<comments>http://iandunn.name/creating-admin-notices-from-a-wordpress-plugin/#comments</comments>
		<pubDate>Tue, 15 May 2012 20:53:56 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Admin Notices]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[IDAdminNotices]]></category>
		<category><![CDATA[IDDescribeVar]]></category>
		<category><![CDATA[Plugin Development]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=1322</guid>
		<description><![CDATA[I just threw a couple small PHP classes up on GitHub that I use in almost every WordPress plugin I write. The first is  <a href="https://github.com/iandunn/IDAdminNotices">IDAdminNotices</a> , which is a clean and easy way for plugins and themes to send messages/errors to the user within the Administration Panels. The second is <a href="https://github.com/iandunn/IDDescribeVar">IDDescribeVar</a> , which will outputs the type, length and contents... [<a href="http://iandunn.name/creating-admin-notices-from-a-wordpress-plugin/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>I just threw a couple small PHP classes up on GitHub that I use in almost every WordPress plugin I write. The first is <a href="https://github.com/iandunn/IDAdminNotices">IDAdminNotices</a>, which is a clean and easy way for plugins and themes to send messages/errors to the user within the Administration Panels. The second is <a href="https://github.com/iandunn/IDDescribeVar">IDDescribeVar</a>, which will outputs the type, length and contents of a variable in a readable format, and send it to wp_die(), die(), return, set_transient(), or an IDAdminNotice.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/creating-admin-notices-from-a-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BackPress PHP Library</title>
		<link>http://iandunn.name/backpress-php-library/</link>
		<comments>http://iandunn.name/backpress-php-library/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 21:47:58 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[BackPress]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Libraries]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=1202</guid>
		<description><![CDATA[<a href="http://backpress.org/">BackPress</a> is a useful project that packages the re-usable code from WordPress into an independent library you can use in non-WordPress projects.]]></description>
			<content:encoded><![CDATA[<p><a href="http://backpress.org/">BackPress</a> is a useful project that packages the re-usable code from WordPress into an independent library you can use in non-WordPress projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/backpress-php-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FastCGI errors after PHP upgrade</title>
		<link>http://iandunn.name/fastcgi-errors-after-php-upgrade/</link>
		<comments>http://iandunn.name/fastcgi-errors-after-php-upgrade/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 02:00:16 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Atomic Rocket Turtle]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[MediaTemple]]></category>
		<category><![CDATA[suexec]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=1173</guid>
		<description><![CDATA[I ran into a small problem upgrading PHP from 5.3.5 to 5.3.10 on a MediaTemple CentOS VPS today. The upgrade completed without any errors, but when I reloaded the site I got a &#8220;500 Internal Server Error&#8221; message. It was the stock installation, so I&#8217;m not sure which module it was using or what repository... [<a href="http://iandunn.name/fastcgi-errors-after-php-upgrade/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>I ran into a small problem upgrading PHP from 5.3.5 to 5.3.10 on a MediaTemple CentOS VPS today. The upgrade completed without any errors, but when I reloaded the site I got a &#8220;500 Internal Server Error&#8221; message. It was the stock installation, so I&#8217;m not sure which module it was using or what repository it came from, but I was upgrading it from the <a href="http://www.atomicorp.com/downloads.html">Atomic</a> repository, which loads the FastCGI module by default. The odd thing is that it worked fine on the dev VPS, but not on production.</p>
<p>It turned out to be an easy fix once I figured out the problem, though; I just had to change the ownership of /var/www/cgi-bin and it&#8217;s contents so that the apache user could execute cgi_wrapper.</p>
<p>Here&#8217;s what was turning up in the error logs:</p>
<p>Apache vhost error_log</p>
<p style="padding-left: 30px;">[warn] [client xx.xx.xx.xx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server<br />
[error] [client xx.xx.xx.xx] Premature end of script headers: index.php</p>
<p>/var/log/httpd/error_log</p>
<p style="padding-left: 30px;">suexec policy violation: see suexec log for more details</p>
<p>/var/log/httpd/suexec_log</p>
<p style="padding-left: 30px;">uid: (10001/username) gid: (505/505) cmd: cgi_wrapper</p>
<p>/var/log/httpd/suexec.log</p>
<p style="padding-left: 30px;">target uid/gid (10001/505) mismatch with directory (0/0) or program (0/0)<br />
uid: (10001/username) gid: (505/505) cmd: cgi_wrapper</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/fastcgi-errors-after-php-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Testing WordPress Plugins</title>
		<link>http://iandunn.name/unit-testing-wordpress-plugins/</link>
		<comments>http://iandunn.name/unit-testing-wordpress-plugins/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 01:38:08 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Standards and Best Practices]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Integration Testing]]></category>
		<category><![CDATA[MockPress]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Plugin Development]]></category>
		<category><![CDATA[Reflection]]></category>
		<category><![CDATA[SimpleTest]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=988</guid>
		<description><![CDATA[Nikolay Bachiyski gave a good talk at this year&#8217;s WordCamp San Francisco about <a title="Unit Testing Will Change Your Life" href="http://wordpress.tv/2011/08/20/nikolay-bachiyski-unit-testing-will-change-your-life/">unit testing WordPress plugins</a> . His method uses <a href="http://www.phpunit.de/manual/current/en/index.html">PHPUnit</a> , which is an additional PEAR package you have to install on the server. You can then use <a title="A series of mock functions to simulate WordPress for use with a unit testing framework" href="https://github.com/johnbintz/mockpress">MockPress</a> to simulate WordPress in the tests. Another option is the <a href="http://wordpress.org/extend/plugins/simpletest-for-wordpress/">SimpleTest for WordPress plugin</a> , which uses <a href="http://www.simpletest.org/">SimpleTest</a> instead of PHPUnit, doesn&#8217;t require installing a PEAR... [<a href="http://iandunn.name/unit-testing-wordpress-plugins/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>Nikolay Bachiyski gave a good talk at this year&#8217;s WordCamp San Francisco about <a title="Unit Testing Will Change Your Life" href="http://wordpress.tv/2011/08/20/nikolay-bachiyski-unit-testing-will-change-your-life/">unit testing WordPress plugins</a>. His method uses <a href="http://www.phpunit.de/manual/current/en/index.html">PHPUnit</a>, which is an additional PEAR package you have to install on the server. You can then use <a title="A series of mock functions to simulate WordPress for use with a unit testing framework" href="https://github.com/johnbintz/mockpress">MockPress</a> to simulate WordPress in the tests.</p>
<p>Another option is the <a href="http://wordpress.org/extend/plugins/simpletest-for-wordpress/">SimpleTest for WordPress plugin</a>, which uses <a href="http://www.simpletest.org/">SimpleTest</a> instead of PHPUnit, doesn&#8217;t require installing a PEAR package, and lets you run both unit and  integration tests.</p>
<p>Either way, you can use PHP&#8217;s ReflectionClass to <a title="Best practices to test protected methods with PHPUnit" href="http://stackoverflow.com/questions/249664/best-practices-to-test-protected-methods-with-phpunit">test private and protected methods</a>, although purists will tell you <a title="Do you test private [methods]?" href="http://stackoverflow.com/questions/105007/do-you-test-private-method">that&#8217;s not proper</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/unit-testing-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance Improvements for Dedicated WordPress Servers</title>
		<link>http://iandunn.name/performance-improvements-for-dedicated-wordpress-servers/</link>
		<comments>http://iandunn.name/performance-improvements-for-dedicated-wordpress-servers/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 20:45:14 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Benchmarks]]></category>
		<category><![CDATA[Mark Maunder]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP-APC]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=952</guid>
		<description><![CDATA[Mark Maunder <a title="The Basic WordPress Speedup" href="http://markmaunder.com/2011/the-basic-wordpress-speedup/">benchmarked several performance tuning measures</a> with a WordPress installation on a VPS server to show which are most effective. The biggest improvements were from installing <a href="http://php.net/manual/en/book.apc.php">PHP-APC</a> , setting up <a href="http://nginx.org/">Nginx</a> to proxy concurrent connections for Apache, and using MySQL&#8217;s query cache.]]></description>
			<content:encoded><![CDATA[<p>Mark Maunder <a title="The Basic WordPress Speedup" href="http://markmaunder.com/2011/the-basic-wordpress-speedup/">benchmarked several performance tuning measures</a> with a WordPress installation on a VPS server to show which are most effective. The biggest improvements were from installing <a href="http://php.net/manual/en/book.apc.php">PHP-APC</a>, setting up <a href="http://nginx.org/">Nginx</a> to proxy concurrent connections for Apache, and using MySQL&#8217;s query cache.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/performance-improvements-for-dedicated-wordpress-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse Error When Installing WordPress 3.2 on a PHP4 Server</title>
		<link>http://iandunn.name/parse-error-when-installing-wordpress-3-2-on-a-php4-server/</link>
		<comments>http://iandunn.name/parse-error-when-installing-wordpress-3-2-on-a-php4-server/#comments</comments>
		<pubDate>Fri, 20 May 2011 03:15:17 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Clone]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=857</guid>
		<description><![CDATA[This is the error you&#8217;ll get if you try to install WordPress 3.2 on a PHP4 server: Parse error: parse error, unexpected T_VARIABLE in /path/to/your/directory/wp-includes/load.php on line 566 It&#8217;s because <a href="http://acko.net/node/54">the clone keyword doesn&#8217;t exist in PHP4</a> .]]></description>
			<content:encoded><![CDATA[<p>This is the error you&#8217;ll get if you try to install WordPress 3.2 on a PHP4 server:</p>
<p style="padding-left: 30px;"><strong>Parse error</strong>:  parse error, unexpected T_VARIABLE in <strong>/path/to/your/directory/wp-includes/load.php</strong> on line <strong>566</strong></p>
<p>It&#8217;s because <a href="http://acko.net/node/54">the <em>clone</em> keyword doesn&#8217;t exist in PHP4</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/parse-error-when-installing-wordpress-3-2-on-a-php4-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Chained Properties Inside $wpdb-&gt;prepare()</title>
		<link>http://iandunn.name/using-chained-properties-inside-wpdb-prepare/</link>
		<comments>http://iandunn.name/using-chained-properties-inside-wpdb-prepare/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 23:23:30 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Curly Braces]]></category>
		<category><![CDATA[Prepare]]></category>
		<category><![CDATA[WPDB]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=701</guid>
		<description><![CDATA[If you&#8217;re using $wpdb-&#62;prepare() to query a custom table, you can&#8217;t pass the table name in as an argument because it will be single-quoted, which would be a MySQL syntax error. Instead, you need to insert the variable directly into the double-quoted query string and let PHP parse it out. That creates a new problem,... [<a href="http://iandunn.name/using-chained-properties-inside-wpdb-prepare/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using $wpdb-&gt;prepare() to query a custom table, you can&#8217;t pass the table name in as an argument because it will be single-quoted, which would be a MySQL syntax error. Instead, you need to insert the variable directly into the double-quoted query string and let PHP parse it out.</p>
<p>That creates a new problem, though, if the table name is stored in a chained property. PHP will only parse out the first level, so it&#8217;ll come out as something like <em>&#8220;database_name.Object ID #3-&gt;column_name&#8221;</em>. To fix that, you need to wrap the entire chain in curly braces, this like:</p>
<pre class="brush: php; title: ; notranslate">
$resultRows = $wpdb-&gt;get_results(
  $wpdb-&gt;prepare(
    &quot;SELECT result_id FROM `{$this-&gt;cfs-&gt;resultsTable}` WHERE user_id = %d&quot;,
    $user_id
  ), ARRAY_A
);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/using-chained-properties-inside-wpdb-prepare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a Blip.tv Thumbnail from the Embed URL</title>
		<link>http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/</link>
		<comments>http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 09:22:13 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Blip.tv]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=462</guid>
		<description><![CDATA[Here&#8217;s a function I wrote to get the thumbnail URL for a Blip.tv video when all you have is the embed URL. It can parse the embed URL out of a larger block of text (e.g., a blog post). It doesn&#8217;t use their API, which makes it easier to setup, but also means it might... [<a href="http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a function I wrote to get the thumbnail URL for a Blip.tv video when all you have is the embed URL. It can parse the embed URL out of a larger block of text (e.g., a blog post). It doesn&#8217;t use their API, which makes it easier to setup, but also means it might break in the future if they change things.</p>
<pre class="brush: php; title: ; notranslate">
/**
* Gets a Blip.tv video thumbnail URL when given a embed URL
* $author Ian Dunn
* @param string $embedURL e.g., http://blip.tv/play/hZBPgqbXeQA
* @param string $parse If equal to 'parse' then we'll try to parse the URL out of a larger block of text (like a post's $content), otherwise we'll assume it's the exact URL
* @return mixed If successful, the URL string e.g., http://a.images.blip.tv/Brandon-bgintro7369.jpg. If unsuccessful, boolean false
*/
function getBlipThumbnail($embedURL, $parse = '')
{
	$urlStart = strpos($embedURL, 'blip.tv/play/');
	if($urlStart === false)
		return false;

	// Parse out the embed URL if needed
	if($parse == 'parse')
	{
		$substrLength = strpos($embedURL, '&quot;', $urlStart) - $urlStart;
		$embedURL = 'http://' . substr($embedURL, $urlStart, $substrLength);
	}

	// Open the redirect page
	$handler = curl_init();
	curl_setopt($handler, CURLOPT_URL, $embedURL);
	curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1);
	$redirectPage = curl_exec($handler);
	curl_close($handler);

	// Parse out the ID
	$urlStart = strpos($redirectPage, '?file=');
	$substrLength = strpos($redirectPage, '&amp;', $urlStart) - $urlStart;
	$redirectURL = substr($redirectPage, $urlStart, $substrLength);
	$id = substr($redirectURL, strrpos($redirectURL, '%2F') + 3);

	// Get video details
	$handler = curl_init();
	curl_setopt($handler, CURLOPT_URL, 'http://blip.tv/rss/'. $id);
	curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1);
	$videoRSS = curl_exec($handler);
	curl_close($handler);

	// Parse out the thumbnail URL
	$urlStart = strpos($videoRSS, '');

	if($urlStart !== false)
	{
		$substrLength = strpos($videoRSS, '', $urlStart) - $urlStart;
		$thumbnailURL = substr($videoRSS, $urlStart + 21, $substrLength - 21);
	}
	else
	{
		$urlStart = strpos($videoRSS, 'media:thumbnail url=&quot;');

		if($urlStart !== false)
		{
			$substrLength = strpos($videoRSS, '&quot;/&gt;', $urlStart) - $urlStart;
			$thumbnailURL = substr($videoRSS, $urlStart + 21, $substrLength - 21);
		}
		else
			return false;
	}

	return $thumbnailURL;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Error Logs with Virtuozzo</title>
		<link>http://iandunn.name/php-error-logs-with-virtuozzo/</link>
		<comments>http://iandunn.name/php-error-logs-with-virtuozzo/#comments</comments>
		<pubDate>Mon, 10 May 2010 19:26:03 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[OpenVZ / Virtuozzo / Plesk]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Logging]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=278</guid>
		<description><![CDATA[Virtuozzo sets domains up to have PHP&#8217;s display_errors flag turned off by default, so that you&#8217;ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you&#8217;re trying to debug something. Instead of displaying... [<a href="http://iandunn.name/php-error-logs-with-virtuozzo/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>Virtuozzo sets domains up to have PHP&#8217;s display_errors flag turned off by default, so that you&#8217;ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you&#8217;re trying to debug something.</p>
<p>Instead of displaying the errors, you can configure PHP to log them and then use the logs for debugging. For a Linux environment, you&#8217;ll need to create a file named vhost.conf inside the domain&#8217;s conf directory, <em>/var/www/vhosts/domain.name/conf</em>.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;Directory /var/www/vhosts/domain.name&gt;
  php_value error_log /var/www/vhosts/domain.name/statistics/logs/php-errors.log
  php_flag display_errors off
  php_value error_reporting 6143
  php_flag log_errors on
&lt;/Directory&gt;
</pre>
<p>Then create the file and assign it the right permissions</p>
<pre class="brush: bash; title: ; notranslate">
  cd /var/www/vhosts/domain.name/statistics/logs/
  touch php-errors.log
  chown apache php-errors.log
</pre>
<p>And the last thing is to tell Apache to reread the updated conf file</p>
<pre class="brush: bash; title: ; notranslate">
  /usr/local/psa/admin/sbin/websrvmng -a
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/php-error-logs-with-virtuozzo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Natural Sorting for MySQL</title>
		<link>http://iandunn.name/natural-sorting-for-mysql/</link>
		<comments>http://iandunn.name/natural-sorting-for-mysql/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 16:38:02 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=242</guid>
		<description><![CDATA[MySQL doesn&#8217;t provide a way to perform <a href="http://sourcefrog.net/projects/natsort/">natural sorting</a> on a string, so if you have numbers in your data you may get results like this Product 110 Product 120 Product 13 Product 140 There are a lot of hacks available, but all of the ones I&#8217;ve seen only work in specific circumstances. The only comprehensive solution... [<a href="http://iandunn.name/natural-sorting-for-mysql/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>MySQL doesn&#8217;t provide a way to perform <a href="http://sourcefrog.net/projects/natsort/">natural sorting</a> on a string, so if you have numbers in your data you may get results like this</p>
<p style="padding-left: 30px;">Product 110<br />
Product 120<br />
Product 13<br />
Product 140</p>
<p>There are a lot of hacks available, but all of the ones I&#8217;ve seen only work in specific circumstances. The only comprehensive solution I found to do the sorting in MySQL is <a href="http://drupal.org/project/natsort">Drupal&#8217;s natsort module</a>. You don&#8217;t need to be running Drupal to use it, just issue the queries that create the function and it&#8217;s dependencies, and you can then call it in your regular queries. But, it requires MySQL 5, so if you&#8217;re working on an older server and your data doesn&#8217;t work with one of the hacks, then you&#8217;ll probably just have to do the natural sorting in your scripting language, using something like <a href="http://us2.php.net/manual/en/function.natsort.php">PHP&#8217;s natsort()</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/natural-sorting-for-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

