<?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>Whiteforest &#187; PHP</title>
	<atom:link href="http://www.whiteforest.co.uk/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whiteforest.co.uk</link>
	<description>Mark Robson&#039;s web development blog</description>
	<lastBuildDate>Mon, 22 Mar 2010 11:18:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Random SQL Results</title>
		<link>http://www.whiteforest.co.uk/2008/11/random-sql-results/</link>
		<comments>http://www.whiteforest.co.uk/2008/11/random-sql-results/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 23:07:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.whiteforest.co.uk/?p=52</guid>
		<description><![CDATA[Last year I needed to display 3 random featured items. The solution was very simple using MySQL with this query:
SELECT * FROM `table` WHERE `column` = 'criteria' ORDER BY RAND() LIMIT 3;
]]></description>
		<wfw:commentRss>http://www.whiteforest.co.uk/2008/11/random-sql-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick and dirty query generator</title>
		<link>http://www.whiteforest.co.uk/2008/11/quick-and-dirty-query-generator/</link>
		<comments>http://www.whiteforest.co.uk/2008/11/quick-and-dirty-query-generator/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 15:44:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.whiteforest.co.uk/?p=33</guid>
		<description><![CDATA[Again, I needed to quicky put in WHERE and ANDs depending on how many parameters were submitted. 
Instead of putting multiple conditionals, I just put them into an array:

$sqlarray = array();
if($year)
	$sqlarray[] = "(table.Year = " . $year . ")";
if($week)
	$sqlarray[] = "(table.Week = " . $week . ")";

if($otherparameter)
	  $sqlarray[] = "(otherparam = '" . $otherparam [...]]]></description>
		<wfw:commentRss>http://www.whiteforest.co.uk/2008/11/quick-and-dirty-query-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inserting a Space Before a Capital Letter</title>
		<link>http://www.whiteforest.co.uk/2008/10/inserting-a-space-before-a-capital-letter/</link>
		<comments>http://www.whiteforest.co.uk/2008/10/inserting-a-space-before-a-capital-letter/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 13:51:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[regular expression]]></category>

		<guid isPermaLink="false">http://www.whiteforest.co.uk/?p=28</guid>
		<description><![CDATA[I needed to insert a space between a camel case string, however, some of the strings contained more than one uppercase letter. I needed to have a regular expression that inserted a space only after an uppercase letter that had a lowercase letter following it. Here is the code:

1
2
3
4
5
//put space after uppercase
$string = preg_replace&#40;'/(\w+)([A-Z])/U', '\\1 [...]]]></description>
		<wfw:commentRss>http://www.whiteforest.co.uk/2008/10/inserting-a-space-before-a-capital-letter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Incrementing date</title>
		<link>http://www.whiteforest.co.uk/2008/10/incrementing-date/</link>
		<comments>http://www.whiteforest.co.uk/2008/10/incrementing-date/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 13:49:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[date]]></category>

		<guid isPermaLink="false">http://www.whiteforest.co.uk/?p=26</guid>
		<description><![CDATA[
$date = date("Y-m-d");
for($day = 0; $day &#60; 5;$day++)
{
echo date("jS F",strtotime($date));
$date = date("jS F",strtotime($date) + 86400);
}

]]></description>
		<wfw:commentRss>http://www.whiteforest.co.uk/2008/10/incrementing-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting Specific Array</title>
		<link>http://www.whiteforest.co.uk/2008/10/sorting-specific-array/</link>
		<comments>http://www.whiteforest.co.uk/2008/10/sorting-specific-array/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 13:05:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>

		<guid isPermaLink="false">http://www.whiteforest.co.uk/?p=24</guid>
		<description><![CDATA[I needed to dynamically load a group of options from the database. The thing was that these were not organised alphabetically; instead they were ordered in platinum, gold, silver, bronze format. This posed a little bit of a problem. The way around it was seeting up an array with the correct order of options. Then [...]]]></description>
		<wfw:commentRss>http://www.whiteforest.co.uk/2008/10/sorting-specific-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
