<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 08:46:01 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Procurios Blog: Syntactic Sugar for MySQLi Results using SPL Iterators]]></title>
      <guid>http://www.phpdeveloper.org/news/12523</guid>
      <link>http://www.phpdeveloper.org/news/12523</link>
      <description><![CDATA[<p>
From the Procurios blog there's <a href="http://techblog.procurios.nl/k/618/news/view/33914/14863/Syntactic-Sugar-for-MySQLi-Results-using-SPL-Iterators.html">a recent post</a> looking at a method letting you use a foreach on the results from a MySQLi request - SPL Iterators.
</p>
<blockquote>
Ever wondered why you can't use foreach() on MySQLi Results, and instead have to write less convenient while() loops with fetch_row? Actually, you can use foreach() on MySQLi Results. All it takes is some SPL Iterator magic.
</blockquote>
<p>
The code examples show how to create an Iterator interface (with rewind, current, key, next and valid methods) to create a ResultIterator class for moving back and forth between the values in the result. This allows you to define the new Iterator object and use the foreach structure like you would a normal result set.
</p>
<p>
They also show how to bypass this whole problem by using a <a href="http://nl.php.net/manual/en/class.iteratoraggregate.php">IteratorAggregate</a> in an extension of the MySQLi interface.
<p>]]></description>
      <pubDate>Fri, 15 May 2009 11:14:31 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Handling Result Sets and More with PDO Objects in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/7964</guid>
      <link>http://www.phpdeveloper.org/news/7964</link>
      <description><![CDATA[<p>
DevShed continues their series looking at using PDO objects in PHP with <a href="http://www.devshed.com/c/a/PHP/Handling-Result-Sets-and-More-with-PDO-Objects-in-PHP-5/">part two</a>, a look at handling the result sets in your PHP5 code.
</p>
<blockquote>
All in all, at this point you hopefully learned how to use some basic methods included with this PHP extension, but logically you may want to learn a few additional ones, so you can have a more polished picture of the overall functionality of the library in question. [...] I'm going to show you how to use the PDO extension to handle different database result sets in all sort of clever ways, in addition to performing some common tasks, like counting rows and columns as well.
</blockquote>
<p>
He <a href="http://www.devshed.com/c/a/PHP/Handling-Result-Sets-and-More-with-PDO-Objects-in-PHP-5/1/">starts with</a> an example of the best place to start - fetching the results set from the database backend. In these simple examples, use the prepare, execute and fetch functions to get the results. Taking it one step further, they move into the use of the fetchAll function to grab columns and rows in the results as well.
</p>]]></description>
      <pubDate>Mon, 04 Jun 2007 13:47:00 -0500</pubDate>
    </item>
  </channel>
</rss>
