<?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>Simon James Clegg &#187; php</title>
	<atom:link href="http://simonjamesclegg.co.uk/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://simonjamesclegg.co.uk</link>
	<description>Freelance web developer and IT consultant</description>
	<lastBuildDate>Wed, 05 May 2010 06:54:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>360 degree feedback tool</title>
		<link>http://simonjamesclegg.co.uk/2009/08/oakridge-360-degree-feedback-assessment/</link>
		<comments>http://simonjamesclegg.co.uk/2009/08/oakridge-360-degree-feedback-assessment/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 08:51:53 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Featured Work]]></category>
		<category><![CDATA[Moodle]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Recent work]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[e-Learning]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[360 degree feedback]]></category>
		<category><![CDATA[Feedback]]></category>
		<category><![CDATA[Moodle development]]></category>
		<category><![CDATA[Moodle modules]]></category>
		<category><![CDATA[multi-rater feedback]]></category>
		<category><![CDATA[multisource assessment]]></category>
		<category><![CDATA[multisource feedback]]></category>
		<category><![CDATA[Oakridge Online]]></category>
		<category><![CDATA[Oakridge Training and Consulting]]></category>

		<guid isPermaLink="false">http://simonjamesclegg.co.uk/?p=166</guid>
		<description><![CDATA[I have just begun a major development project on behalf of Oakridge Online for one of their largest pharmaceutical clients.]]></description>
			<content:encoded><![CDATA[<p><a title="Oakridge Training and Consulting" href="http://oakridge-online.co.uk"><img class="alignnone size-full wp-image-181" title="Oakridge Training and Consulting" src="http://simonjamesclegg.co.uk/wp-content/uploads/2009/09/oakridge_logo.png" alt="Oakridge Training and Consulting" width="490" height="164" /></a></p>
<p>I have just begun a major development project on behalf of <a title="Oakridge Online | 3060 degree feedback assessment" href="http://oakridge-online.co.uk">Oakridge Online</a> for one of their largest pharmaceutical clients. With an international team of consultants Oakridge will soon be delivering a blended training programme to a large number of deligates  from the US, Sweden and UK with plans to pick up in Bangalore, Asia Pacific and Moscow.</p>
<p><strong>Oakridge Online</strong> is based on the increasingly popular Course Management System or Virtual Learning Environment <a href="http://simonjamesclegg.co.uk/moodle.php">Moodle</a>. The new <strong>360 degree assessment tool</strong> that I am currently developing for Oakridge Training and Consulting integrates seamlessly with Moodle but if needed can be implemented as an entirely stand-alone application. Oakridge  will be developing questions for the <strong>360 degree feedback</strong> to support their Decision Making programme. The Feedback application however is being designed as a generic <strong>360  degree feedback tool</strong> using the rating-scale question type typical of the 360 degree assessment model, so Oakridge Training and Consulting will be able to develop unique 360 degree assessments for all their future online programmes.</p>
<div><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=&amp;url=http%3A%2F%2Fsimonjamesclegg.co.uk%2F2009%2F08%2Foakridge-360-degree-feedback-assessment%2F&amp;title=360+degree+feedback+tool', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank"><img src="http://s3.addthis.com/button1-bm.gif" width="125" height="16" border="0" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonjamesclegg.co.uk/2009/08/oakridge-360-degree-feedback-assessment/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Sefton court bed and breakfast</title>
		<link>http://simonjamesclegg.co.uk/2009/07/sefton-court-bed-and-breakfast/</link>
		<comments>http://simonjamesclegg.co.uk/2009/07/sefton-court-bed-and-breakfast/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 20:45:28 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Partners]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Recent work]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[availability checker]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[hotel booking system]]></category>
		<category><![CDATA[hotel website]]></category>

		<guid isPermaLink="false">http://simonjamesclegg.co.uk/?p=150</guid>
		<description><![CDATA[SeftonÂ Court is a Michelin approved bed and breakfast in Llandudno, North Wales. David White of Whitekite design, a close working partner of mine, won the contract to redesign the hotel website and he asked me to develop the front-end online booking system with room availability checker together with a back-end booking management application. Having [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-151" href="http://simonjamesclegg.co.uk/2009/07/07/sefton-court-bed-and-breakfast/sefton/"><img class="alignnone size-full wp-image-151" title="sefton" src="http://simonjamesclegg.co.uk/wp-content/uploads/2009/07/sefton.png" alt="" width="496" height="159" /></a></p>
<p><strong>SeftonÂ Court</strong> is a Michelin approved  bed and breakfast in Llandudno, North Wales.</p>
<p>David White of Whitekite design, a close working partner of mine, won the contract to redesign the hotel website and he asked me to develop the front-end <strong>online booking system </strong>with <strong>room availability checker</strong> together with a back-end <strong>booking management</strong> application. Having looked at the option of a Joomla!-based CMS with room booking component I was commissioned in the end to develop an entirely original and bespoke application. We are now very close to launching the site, so please come back shortly to see the results!</p>
<p>This bespoke <strong>online hotel booking managment system</strong> includes:</p>
<ul>
<li>Entirely bespoke fully featured hotel booking management system</li>
<li>Online automated room availability checker</li>
<li>Room reservation application with secure hosting</li>
<li>Encrypted temporary storage of payment details</li>
<li>Hooks up easily to any online payment gateway</li>
<li>Back-end administration for managing rooms, images, descriptions, rates</li>
<li>Back-end booking management for manual override</li>
<li>Automated email notifications</li>
<li>PHP, MySQL, SSL, cryptography</li>
</ul>
<div><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=&amp;url=http%3A%2F%2Fsimonjamesclegg.co.uk%2F2009%2F07%2Fsefton-court-bed-and-breakfast%2F&amp;title=Sefton+court+bed+and+breakfast', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank"><img src="http://s3.addthis.com/button1-bm.gif" width="125" height="16" border="0" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonjamesclegg.co.uk/2009/07/sefton-court-bed-and-breakfast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>playpics</title>
		<link>http://simonjamesclegg.co.uk/2009/07/playpics/</link>
		<comments>http://simonjamesclegg.co.uk/2009/07/playpics/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 20:15:57 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Featured Work]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Recent work]]></category>
		<category><![CDATA[Social networking]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[e-Learning]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Schools]]></category>

		<guid isPermaLink="false">http://simonjamesclegg.co.uk/?p=146</guid>
		<description><![CDATA[playpics is a new subscription website for teachers. This new educational resource offers a large library of original images designed specially to support the primary school curriculum. The basis of this project involves a lot of image manipulation and database development while the later phases are to feature more web 2.0 online community functionality. As [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-147" href="http://simonjamesclegg.co.uk/2009/07/playpics/playpics/"></a><a rel="attachment wp-att-147" href="http://simonjamesclegg.co.uk/2009/07/playpics/playpics/"><img class="aligncenter size-full wp-image-147" title="playpics" src="http://simonjamesclegg.co.uk/wp-content/uploads/2009/07/playpics.png" alt="playpics" width="496" height="159" /></a></p>
<p><strong>playpics </strong>is a new subscription website for teachers. This new educational resource offers a large library of original images designed specially to support the primary school curriculum.</p>
<p>The basis of this project involves a lot of image manipulation and database development while the later phases are to feature more web 2.0 online community functionality.</p>
<p>As this is a brand new venture I am unable to give too much away at this stage. But watch this space.</p>
<div><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=&amp;url=http%3A%2F%2Fsimonjamesclegg.co.uk%2F2009%2F07%2Fplaypics%2F&amp;title=playpics', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank"><img src="http://s3.addthis.com/button1-bm.gif" width="125" height="16" border="0" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonjamesclegg.co.uk/2009/07/playpics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL to XML with PHP</title>
		<link>http://simonjamesclegg.co.uk/2008/11/mysql-to-xml-with-php/</link>
		<comments>http://simonjamesclegg.co.uk/2008/11/mysql-to-xml-with-php/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 01:59:01 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://simonjamesclegg.co.uk/?p=52</guid>
		<description><![CDATA[This tutorial is based on a bit of code I created to extend Flash Nifties XML slideshow to use an MySQL database as its datasource. It assumes you have a MySQL database where you store your images. [Download sql2xml.zip for XML Slide Show] Step 1: Make the database connection &#60;?php $con = mysql_connect&#40;&#34;localhost&#34;,&#34;username&#34;,&#34;password&#34;&#41;; if &#40;!$con&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial is based on a bit of code I created to extend <a href="http://www.flashnifties.com/xml_slideshow.php">Flash Nifties XML slideshow</a> to use an MySQL database as its datasource.</p>
<p>It assumes you have a MySQL database where you store your images.<br />
[<a href='http://simonjamesclegg.co.uk/wp-content/uploads/2008/11/sql2xml.zip'>Download sql2xml.zip for XML Slide Show</a>]</p>
<p><strong>Step 1: Make the database connection</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="">'Could not connect: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Step 2: Query your database</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$database</span><span style="color: #339933;">,</span> <span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$query_images</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM images ORDER BY RAND()&quot;</span>;
<span style="color: #000088;">$images</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_images</span><span style="color: #339933;">,</span> <span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000088;">$row_images</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>ORDER BY RAND()</strong> &#8211; this randomizes the results of the query.</p>
<p><strong>Step 3: Generate the XML markup</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//start the xml dataset</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?&gt;
	&lt;slideshow&gt;
	 '</span>;
&nbsp;
		<span style="color: #666666; font-style: italic;">// create a loop that outputs each row from the sql query</span>
&nbsp;
		<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row_images</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$xml</span> <span style="color: #339933;">.=</span><span style="">'	&lt;image img=&quot;images/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$row_images</span><span style="color: #009900;">&#91;</span><span style="">'image_file'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="">'&quot; /&gt;
					'</span>;
&nbsp;
		<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//close the xml dataset</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">.=</span><span style="">'&lt;/slideshow&gt;'</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Step 4: Write the output to file</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="">'slideshow.xml'</span><span style="color: #339933;">,</span> <span style="">'w'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This will look for the file slideshow.xml and will overwrite its contents with the output above. If the fiels does not exist it will attempt to create it.</p>
<p><strong>The result &#8211; slideshow.xml</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;iso-8859-1&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;slideshow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image2.jpg /&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image5.jpg /&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image1.jpg /&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image3.jpg /&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image7.jpg /&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image4jpg /&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;image</span> <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;images/image6.jpg /&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/slideshow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>And there you have your dataset ready for consumption by your application.</p>
<p>In order to use this to technique to extend the <a href="http://www.flashnifties.com/xml_slideshow.php">Flash Nifties XML</a> Slideshow simply <a href='http://simonjamesclegg.co.uk/wp-content/uploads/2008/11/sql2xml.zip'> download sql2xml.zip</a> and follow the instructions contained within.</p>
<p>You can see an example of the databse-driven XML Flash Slideshow at <a href="http://st-andrewsprimary.co.uk">St Andrew&#8217;s Primary School website</a></p>
<div><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=&amp;url=http%3A%2F%2Fsimonjamesclegg.co.uk%2F2008%2F11%2Fmysql-to-xml-with-php%2F&amp;title=MySQL+to+XML+with+PHP', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank"><img src="http://s3.addthis.com/button1-bm.gif" width="125" height="16" border="0" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonjamesclegg.co.uk/2008/11/mysql-to-xml-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP, MySQL and Japanese characters</title>
		<link>http://simonjamesclegg.co.uk/2008/11/displaying-japanese-characters-with-php-from-mysql-data-source/</link>
		<comments>http://simonjamesclegg.co.uk/2008/11/displaying-japanese-characters-with-php-from-mysql-data-source/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 16:58:11 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://simonjamesclegg.co.uk/2008/11/16/displaying-japanese-characters-with-php-from-mysql-data-source/</guid>
		<description><![CDATA[I recently set up a photoblog for my wife. As Junko is Japanese she wanted the ability to write posts in her mother tongue. WordPress handles this perfectly well out of the box but when I came to interrogating the WordPress database to display the latest blog titles on an external page I was just [...]]]></description>
			<content:encoded><![CDATA[<p>I recently set up a <a href="http://chonanclegg.co.uk/photography" title="Junko's photo blog">photoblog</a> for my wife. As Junko is Japanese she wanted the ability to write posts in her mother tongue. WordPress handles this perfectly well out of the box but when I came to interrogating the WordPress database to display the latest blog titles on an <a href="http://chonanclegg.co.uk">external page</a> I was just getting ????. The character encoding of the page was set to utf8 and the collation of the MySQL database and all it&#8217;s tables was also set to utf8_unicode_generals so I was baffled.</p>
<p>I disovered that the reason this was happening is because the default encoding of a php-MySQL connection is utf8. So the solution turns out to be very simple: set the econding for the query session to utf8 with the query: <strong>mysql_query(&#8220;SET NAMES &#8216;utf8&#8242;&#8221;, $connection); </strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$database</span><span style="color: #339933;">,</span> <span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES 'utf8'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM table &quot;</span>;
&nbsp;
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p>If you are using PHP 5.2 or later you need to use instead:</p>
<p><strong>mysql_set_charset(&#8216;utf8&#8242;,$connection); </strong><strong><br />
</strong></p>
<div><a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?pub=&amp;url=http%3A%2F%2Fsimonjamesclegg.co.uk%2F2008%2F11%2Fdisplaying-japanese-characters-with-php-from-mysql-data-source%2F&amp;title=PHP%2C+MySQL+and+Japanese+characters', 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Bookmark using any bookmark manager!" target="_blank"><img src="http://s3.addthis.com/button1-bm.gif" width="125" height="16" border="0" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonjamesclegg.co.uk/2008/11/displaying-japanese-characters-with-php-from-mysql-data-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
