<?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>Young Dutch Design &#187; MySQL</title>
	<atom:link href="http://youngdutchdesign.com/tag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://youngdutchdesign.com</link>
	<description>Young Dutch Design is a new platform for young designers with frequently new added postings about productdesign, webdesign and other related subjects.</description>
	<lastBuildDate>Tue, 14 Jun 2011 20:25:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Local web development on Mac OSX</title>
		<link>http://youngdutchdesign.com/local-web-development-on-mac-osx</link>
		<comments>http://youngdutchdesign.com/local-web-development-on-mac-osx#comments</comments>
		<pubDate>Mon, 29 Mar 2010 21:52:17 +0000</pubDate>
		<dc:creator>Crispijn</dc:creator>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Chmod]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Virtual Host]]></category>

		<guid isPermaLink="false">http://youngdutchdesign.com/?p=3439</guid>
		<description><![CDATA[In my spare time I&#8217;m developing a website based on Zend Framework which I run local, just on my Mac. It&#8217;s very fast, I do not need to upload the modified files and folders to the webserver and I&#8217;m saving money because I do not need web space right now, I only reserved the domain [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-3441" title="webdevelopment" src="http://youngdutchdesign.com/wp-content/uploads/2010/03/webdevelopment-e1269555232156.jpg" alt="" width="200" height="200" />In my spare time I&#8217;m developing a website based on Zend Framework which I run local, just on my Mac. It&#8217;s very fast, I do not need to upload the modified files and folders to the webserver and I&#8217;m saving money because I do not need web space right now, I only reserved the domain I&#8217;d like to use in the future.</p>
<p>When I add more and more functionality I&#8217;m exploring a lot of handy tweaks or commands that are not always just as you see on your webserver. Here are several of this tweaks and I&#8217;m sure I&#8217;ll explore more in the future. Do you guys have some suggestions?<br />
<span id="more-3439"></span><!--index--></p>
<h2>Virtual host</h2>
<p>Setting up a virtual host is very easy and the url is very nice, short and clean if you have set it up. You can get a address like this: <em>http://domainname.local</em> or something like that.</p>
<p>Just add the following lines at the bottom of your <strong>.httpconf</strong> file that can be found in the folder <em>/etc/apache2/</em></p>
<p style="padding-left: 30px;"><em>&lt;VirtualHost *:80&gt;<br />
DocumentRoot &#8220;/Users/myusername/Sites/domainname/public&#8221;<br />
ServerName mylocaldomain.local</em></p>
<p style="padding-left: 30px;"><em># This should be omitted in the production environment<br />
SetEnv APPLICATION_ENV development</em></p>
<p style="padding-left: 60px;"><em>&lt;Directory &#8220;/Users/</em><em>myusername</em><em>/Sites/</em><em>domainname</em><em>/public&#8221;&gt;</em> <em><br />
Options Indexes MultiViews FollowSymLinks<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</em></p>
<p style="padding-left: 30px;"><em>&lt;/VirtualHost&gt;</em></p>
<p><a href="http://youngdutchdesign.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-23.03.16-.png"><img class="alignright size-full wp-image-3440" title="Screen shot 2010-03-25 at 23.03.16" src="http://youngdutchdesign.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-23.03.16--e1269554637511.png" alt="" width="250" height="114" /></a></p>
<h2>Chmod</h2>
<p>For uploading files you&#8217;ll have to make the folder writable with the chmod command. Instead of opening your favorite ftp client, just open Terminal and type the following line:</p>
<p style="padding-left: 30px;"><em>Chmod 777 sites/domainname/etc/images/</em></p>
<p><a href="http://youngdutchdesign.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-23.19.03-.png"><img class="alignright size-full wp-image-3450" title="Screen shot 2010-03-25 at 23.19.03" src="http://youngdutchdesign.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-23.19.03--e1269555768656.png" alt="" width="250" height="145" /></a></p>
<h2>MySQL server</h2>
<p><a href="http://dev.mysql.com/downloads/mysql/" target="_blank">Download MySQL Community Server</a> for OSX and have MySQL available in seconds. A nice MySQL status tab is added to the <strong>Preferences</strong> tab. You can also start the MySQL server on startup.</p>
<p>You can download <a href="http://www.phpmyadmin.net/home_page/index.php" target="_blank">phpMyAdmin</a> to maintain the database or use another MySQL administration tool.</p>
<h2>Google Maps</h2>
<p>If you need some Google Maps functionality it can be an outcome to develop on your own machine. I&#8217;ve <a href="http://code.google.com/apis/maps/signup.html" target="_blank">requested my API key</a> with the local addres, <em>http://domainname.local</em>, and this works! I&#8217;m glad Google hasn&#8217;t blocked this!</p>
<p><strong>NOTE</strong><br />
Google Maps is not available when another user on your network visits your testing server. If you&#8217;d like this you&#8217;ll need to buy a Google Enterprise license.</p>
]]></content:encoded>
			<wfw:commentRss>http://youngdutchdesign.com/local-web-development-on-mac-osx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql_num_rows with PDO</title>
		<link>http://youngdutchdesign.com/pdo-numrows</link>
		<comments>http://youngdutchdesign.com/pdo-numrows#comments</comments>
		<pubDate>Fri, 06 Mar 2009 09:12:37 +0000</pubDate>
		<dc:creator>Crispijn</dc:creator>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://youngdutchdesign.com/?p=643</guid>
		<description><![CDATA[I&#8217;ve switched a couple of years ago to PDO to manage all the database actions. PDO (PHP Data Objects) is an object orientated extension that requires at least php 5.1. In many cases software improves and is often more easy to use. But why did the php development-team  forgot to write a similar function like [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve switched a couple of years ago to PDO to manage all the database actions. PDO (PHP Data Objects) is an object orientated extension that requires at least php 5.1. In many cases software improves and is often more easy to use. But why did the php development-team  forgot to write a similar function like <a href="http://php.net/mysql_num_rows" target="_blank">mysql_num_rows</a>?</p>
<p>In this case you always need to run an extra query to retrieve the total records. See the examples below.</p>
<p><span id="more-643"></span></p>
<h2>Old style</h2>
<pre class="php">$sql = "SELECT id, name FROM table WHERE cat = 1";
$res = mysql_query($sql);
$count = mysql_num_rows($res);</pre>
<p>Read more about the <a href="http://youngdutchdesign.com/minimum-error-handling-on-mysql-with-php">basic error handler</a> in a previous article.</p>
<h2>PDO style</h2>
<pre class="php">try{
	$sql = "SELECT COUNT(id), name FROM table WHERE cat = 1";
	$res = $this-&gt;db-&gt;prepare($sql);
	$res-&gt;execute();

	//count the rows
	$count = $res-&gt;fetchColumn();
}catch(PDOException $e){
	//Basic error handler
	return $e-&gt;getMessage();
	return $sql;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://youngdutchdesign.com/pdo-numrows/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>5 MySql tips</title>
		<link>http://youngdutchdesign.com/5-mysql-tips</link>
		<comments>http://youngdutchdesign.com/5-mysql-tips#comments</comments>
		<pubDate>Thu, 05 Mar 2009 08:45:17 +0000</pubDate>
		<dc:creator>Crispijn</dc:creator>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://youngdutchdesign.com/?p=652</guid>
		<description><![CDATA[For programmers who are starting with mysql a couple of tips to make life easier. A small list of basic tips beside the most important one: Use an error handler! &#160; &#160; Look to the future, not to the easiest way Use PDO or another extension so you can also use your applications with php [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-667" title="mysql" src="http://youngdutchdesign.com/wp-content/uploads/2009/03/mysql.png" alt="mysql" width="167" height="87" />For programmers who are starting with mysql a couple of tips to make life easier. A small list of basic tips beside the most important one: <a href="http://youngdutchdesign.com/minimum-error-handling-on-mysql-with-php">Use an error handler</a>!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span id="more-652"></span></p>
<ol>
<li><strong>Look to the future, not to the easiest way<br />
</strong>Use PDO or another extension so you can also use your applications with php &gt; 6.0</li>
<li><strong>Never, but I mean NEVER use ` (back ticks)</strong><br />
Choose the fieldnames in the database wisely. Take a look at the list of <a href="http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html" target="_blank">reserved words for MySql</a> and you&#8217;ll know wich words you don&#8217;t have got to choose.</li>
<li><strong>Choose the correct field type<br />
</strong>When you save a date, choose a DATE filed, when you have a decimal choose DECIMAL and so on&#8230;</li>
<li><strong>Destroy, blowup and sink the functions DATE_ADD() and DATE_SUBB()</strong><br />
Use the more logical INTERVAL when you&#8217;re calculating with dates. Read more about the <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html" target="_blank">MySql time and date functions</a>.</li>
<li><strong>Write clean handy query&#8217;s<br />
</strong>I know I don&#8217;t do this on this website but that&#8217;s because of the syntax highlighter.</li>
</ol>
<pre class="php">//A not-clean query.
$sql = "SELECT t.id, t.name, t.cat FROM table AS t INNERJOIN ctable AS c ON t.cat = c.id WHERE t.cat = 1 AND t.name = 'Testdata' ORDER BY t.name ASC LIMIT 0,10";

//A clean one. Note that the syntax highlighter is struggeling with this one and on this blog the 'dirty one' is used...
$sql = "SELECT
			t.id,
			t.name,
			t.cat
		FROM
			table AS t
		INNERJOIN ctable AS c ON t.cat = c.id
		WHERE
			t.cat = 1
		AND
			t.name = 'Testdata'
		ORDER BY
			t.name ASC
		LIMIT 0,10";</pre>
]]></content:encoded>
			<wfw:commentRss>http://youngdutchdesign.com/5-mysql-tips/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minimum error-handling on mysql with php</title>
		<link>http://youngdutchdesign.com/minimum-error-handling-on-mysql-with-php</link>
		<comments>http://youngdutchdesign.com/minimum-error-handling-on-mysql-with-php#comments</comments>
		<pubDate>Thu, 15 Jan 2009 14:20:40 +0000</pubDate>
		<dc:creator>Crispijn</dc:creator>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://youngdutchdesign.com/?p=582</guid>
		<description><![CDATA[When you&#8217;re building a application with php and a MySQL database you can run into trouble when you don&#8217;t have a nice error handler. This article describes the minimum of a error handler. The principles Run the query with php See if there is an error with the query Display the error while the rest [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re building a application with php and a MySQL database you can run into trouble when you don&#8217;t have a nice error handler. This article describes the minimum of a error handler.</p>
<h2>The principles</h2>
<ul>
<li>Run the query with php</li>
<li>See if there is an error with the query</li>
<li>Display the error while the rest of the script <strong>don&#8217;t dies</strong>!</li>
</ul>
<p><span id="more-582"></span></p>
<h2>The php</h2>
<pre class="php">$sql = "SELECT name FROM table WHERE id = 1";
$res = mysql_query($sql);

	//an error occures
	if(!$res){
		trigger_error(mysql_error($sql.'&lt;br /&gt;'.$res));
	}else{
		//fetch the output
		while($row = mysql_fetch_assoc($res)){
			echo $row['name'].PHP_EOL;
		}
	}</pre>
]]></content:encoded>
			<wfw:commentRss>http://youngdutchdesign.com/minimum-error-handling-on-mysql-with-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
