<?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>Tiffany B. Brown &#187; pdo</title>
	<atom:link href="http://tiffanybbrown.com/tag/pdo/feed/" rel="self" type="application/rss+xml" />
	<link>http://tiffanybbrown.com</link>
	<description>A web log about web development and internet culture with frequent detours into other stuff.</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:48:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Review: Learning PHP Data Objects by Dennis Popel</title>
		<link>http://tiffanybbrown.com/2007/10/23/review-learning-php-data-objects-by-dennis-popel/</link>
		<comments>http://tiffanybbrown.com/2007/10/23/review-learning-php-data-objects-by-dennis-popel/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 05:01:56 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[MySQL / Databases]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[pdo]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/2007/10/23/review-learning-php-data-objects-by-dennis-popel/</guid>
		<description><![CDATA[Packt Publishing graciously provided me with a copy of this book to review. PHP supports more than a dozen database setups, including the SQLite library bundled with PHP 5. That&#8217;s a lot of databases, and each one has its own connection syntax and server-specific functions. So what happens when you want to be able to [...]]]></description>
			<content:encoded><![CDATA[<p span class="editors-note">Packt Publishing graciously provided me with a copy of this book to review.</p>
<p><img src='http://tiffanybbrown.com/images/uploads/2007/10/learningpdo.jpg' alt='Learning P H P Data Objects' class="rightimg" /> PHP supports more than a dozen database setups, including the <a href="http://sqlite.org/">SQLite</a> library bundled with PHP 5. That&#8217;s a lot of databases, and each one has its own connection syntax and server-specific functions. </p>
<p>So what happens when you want to be able to swap one database for another? You turn to an abstraction library, such as <a href="http://php.net/pdo"><abbr title="PHP Data Objects">PDO</abbr></a>.
</p>
<p>In <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2FLearning-Data-Objects-Dennis-Poppel%2Fdp%2F1847192661%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1193074907%26sr%3D8-1&#038;tag=webinista-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=9325" class="book title">Learning PHP Data Objects</a><img src="http://www.assoc-amazon.com/e/ir?t=webinista-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, Dennis Popel takes you through the process of building an application using <abbr class="say">PDO</abbr> with My<abbr class="say">SQL</abbr> and SQLite.</p>
<p>Aimed squarely at PHP developers who are new to <abbr class="say">PDO</abbr>, Popel covers how to make connections, handle errors, and use prepared statements with <abbr class="say">PDO</abbr>. He also discusses transactions, <a href="http://en.wikipedia.org/wiki/Model-view-controller"><abbr title="Model-View-Controller">MVC</abbr> development</a>, and the appropriateness of using PDO versus other abstraction libraries.</p>
<p>Where <span class="book title">Learning PHP Data Objects</span> shines,  however is in its code examples. They are easy to follow, and Popel smartly alerts readers to potential gotchas in developing the sample application.</p>
<p>The book assumes an understanding of <abbr title="Object-oriented P H P">OOPHP</abbr> &#8212; necessary because PDO is entirely object-oriented. To get the most out of it, you should be familiar with object-oriented principles and syntax. While Appendix A does give readers a quick overview of <abbr class="say">OOPHP</abbr>, for a more thorough treatment, you&#8217;ll need to look elsewhere.</p>
<p>It&#8217;s a solid, though not quite perfect book. For example, Popel only sort-of mentions a potentially huge gotcha: when you may need to specify a <a href="http://tiffanybbrown.com/2007/10/22/solution-for-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock-error-when-using-pdo/">unix_socket parameter</a> in the connection string. It&#8217;s a problem I think would be common enough and confusing enough to discuss and demonstrate. I also think Popel could have been a bit clearer about when and why to use <code>PDOStatement->closeCursor()</code>.</p>
<p>Those are minor quibbles however, easily solved by consulting the documentation or doing a Google search. Overall, this book is nice introduction to the whys and hows of using PDO to develop database driven applications.</p>
<div class="quickfacts">
<h3>Quick facts</h3>
<ul>
<li class="book title">Learning PHP Data Objects</li>
<li class="book author">By Dennis Popel</li>
<li class="book publisher"><a href="http://www.packtpub.com/">Packt Publishing</a></li>
<li class="book release">September 2007</li>
<li class="book price">$39.99</li>
<li>ISBN number: <span class="ISBN">978-1-847192-66-0</span></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2007/10/23/review-learning-php-data-objects-by-dennis-popel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Solution for &#8220;Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217;&#8221; error when using PDO</title>
		<link>http://tiffanybbrown.com/2007/10/22/solution-for-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock-error-when-using-pdo/</link>
		<comments>http://tiffanybbrown.com/2007/10/22/solution-for-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock-error-when-using-pdo/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 14:54:34 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[MySQL / Databases]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[pdo]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/2007/10/22/solution-for-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock-error-when-using-pdo/</guid>
		<description><![CDATA[If you&#8217;re trying to get up-and-running with PDO, you may experience a &#8220;Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217;&#8221; error when trying to connect to your database, even if your php.ini and my.cnf files contain a different default socket path for MySQL. It&#8217;s counterintuitive to a degree, but it&#8217;s actually expected behavior. The [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying to get up-and-running with <abbr title="P H P Data Objects">PDO</abbr>, you may experience a &#8220;Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217;&#8221; error when trying to connect to your database, even if your php.ini and my.cnf files contain a different default socket path for MySQL.</p>
<p>It&#8217;s counterintuitive to a degree, but it&#8217;s actually expected behavior. The good news is that <a href="http://osdir.com/ml/php.pecl.devel/2006-11/msg00019.html">the fix</a> is easy. Simply include the unix socket path in your connection string. </p>
<pre>
$connection = new PDO("mysql:host=localhost;dbname=test;unix_socket=/path/to/socket/found_in_php.ini_or_my.cnf",'username','password');
</pre>
<p><b>Related:</b> Notes from &#8220;<a href="http://tiffanybbrown.com/2006/06/16/nyphp-con-introduction-to-pdo/">Introduction to PDO</a>,&#8221; a talk by Ilia Alshanetsky at NYPHPCon 2006.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2007/10/22/solution-for-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock-error-when-using-pdo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

