<?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>Mon, 15 Mar 2010 02:52:20 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Carson McDonald's Blog: PHP MySQLi and Multiple Prepared Statements]]></title>
      <guid>http://www.phpdeveloper.org/news/14029</guid>
      <link>http://www.phpdeveloper.org/news/14029</link>
      <description><![CDATA[<p>
When <i>Carson McDonald</i> tried to get multiple prepared statements to work in his MySQLi code for his application, he got a "commands out of sync" error. Luckily, he's <a href="http://www.ioncannon.net/programming/889/php-mysqli-and-multiple-prepared-statements/">found a solution</a> thanks to the <a href="http://php.net/manual/en/mysqli-stmt.store-result.php">store result</a>.
</p>
<blockquote>
Details about this error can be found in the <a href="http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html">mysql docs</a>. Reading those details makes it clear that the result sets of a prepared statement execution need to be fetched completely before executing another prepared statement on the same connection.
</blockquote>
<p>
He gives code snippets that are "before" and "after" examples of what he had to change to get things working. Each time its executed, the "store_result" call is made and the result set is pulled out of the prepared statement.
</p>]]></description>
      <pubDate>Mon, 15 Feb 2010 13:29:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Greebo.net: Converting your PHP app to MySQLi prepared statements]]></title>
      <guid>http://www.phpdeveloper.org/news/13773</guid>
      <link>http://www.phpdeveloper.org/news/13773</link>
      <description><![CDATA[<p>
From Greebo.net there's <a href="http://www.greebo.net/2010/01/02/converting-your-php-app-to-mysqli-prepared-statements/">a recent post</a> that looks at converting the current database functionality in your application over to the MySQLi functionality and making use of prepared statements as a later of protection for your queries.
</p>
<blockquote>
Okay, you've got like a zillion SQL queries in your PHP app, and probably 95% of them have a WHERE clause, and you need to make them safe so people will still download and use your app. Because if you don't fix your injection issues, I will rain fire on your ass. These are the steps you need to take to convert to prepared statements.
</blockquote>
<p>
The guide is two steps you'll need to make the transition - "PHP 4 is dead. Upgrade to PHP 5" and "make sure your hoster has MySQLi". The major part of the update is under the first point where he gives code examples and suggestions to follow about how to "harden" your environment to prevent and issues that lax SQL methods might have caused and a simple example of a move from MySQL to MySQLi.
</p>]]></description>
      <pubDate>Mon, 04 Jan 2010 13:46:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: MySQLi Resultset Iterator]]></title>
      <guid>http://www.phpdeveloper.org/news/12729</guid>
      <link>http://www.phpdeveloper.org/news/12729</link>
      <description><![CDATA[<p>
<i>Johannes Schluter</i> has <a href="http://schlueters.de/blog/archives/112-MySQLi-Resultset-Iterator.html">posted a look</a> at a handy little script that shows an interface between the returned MySQLi results and an SPL iterator.
</p>
<blockquote>
When using MySQLi's multi_query to send queries which return multiple result sets you have to use a rather unintuitive API which can certainly be improved. Recently I sat down and cooked up a small improvement for that, being an iterator fan I, of course, had to use an iterator for that and implemented the following class.
</blockquote>
<p>
The class extends the standard Iterator and provides the interfaces to work through the results of the query in your choice of Iterator-supporting looping structure. Example code for the class and its usage are both included.
</p>]]></description>
      <pubDate>Mon, 22 Jun 2009 11:12:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Dev-Explorer.com: Using MySQL Stored Procedures and Extending MySQLi in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/12719</guid>
      <link>http://www.phpdeveloper.org/news/12719</link>
      <description><![CDATA[<p>
On the Dev-Explorer blog there's <a href="http://www.dev-explorer.com/articles/mysql-stored-procedures-and-mysqli">a post made recently</a> about using stored procedures in your MySQL database via the mysqli interface in PHP.
</p>
<blockquote>
On a new project I am working on I decided to take a look at the MySQLi (MySQL Improved) library. Most of the functions remain the same but it can now be used in object orientated programming which seemed to me as big advantage. Below I look at implementing MySQLi and extending it with your own custom code, along with using it to execute stored procedures.
</blockquote>
<p>
He shows how to create both pieces of the puzzle - the class extending the mysqli functionality and a simple stored procedure on the database side (to insert users into a table). They're tied together with a PHP class with a "storedProcedure" method that runs a query() with a "CALL" to the procedure name.
</p>]]></description>
      <pubDate>Fri, 19 Jun 2009 12:57:28 -0500</pubDate>
    </item>
    <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: The mysqli Extension and the Active Record Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/12344</guid>
      <link>http://www.phpdeveloper.org/news/12344</link>
      <description><![CDATA[<p>
DevShed.com has <a href="http://www.devshed.com/c/a/PHP/The-mysqli-Extension-and-the-Active-Record-Pattern/">posted the seventh article</a> in their series looking at the Active Record design pattern in PHP applications. In this latest tutorial they show how to replace the older MySQL client libraries and use the newer <a href="http://php.net/mysqli">mysqli</a> client instead.
</p>
<blockquote>
Well, as you'll surely recall, I built this class by using the old MySQL library included with the PHP distribution, which is good and efficient. But it's worth making the effort to see how this sample class can be rewritten by using the newer, revamped "mysqli" extension. Thus, this last episode will be dedicated exclusively to doing this, so you can have at your disposal an enhanced versions of the class.
</blockquote>
<p>
For most of the code, you won't see too much of a change - the methods are named similarly and the results are references differently, but you shouldn't have to make too much of a change.
</p>]]></description>
      <pubDate>Wed, 15 Apr 2009 10:27:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Internet Super Hero Blog: PHP 5.3: Persistent Connections with ext/mysqli]]></title>
      <guid>http://www.phpdeveloper.org/news/11981</guid>
      <link>http://www.phpdeveloper.org/news/11981</link>
      <description><![CDATA[<p>
The Internet Super Hero blog has <a href="http://blog.ulf-wendel.de/?p=211">posted some statistics</a> comparing the connections per second that can be made with the newly introduced persistent connection support coming with PHP 5.3 in the <a href="http://php.net/mysqli">mysqli (ext/mysqli)</a> driver.
</p>
<blockquote>
Persistent Connections have been a mixed bag. They can give you a significant performance boost by caching (pooling) connections although MySQL is already comparatively fast at establishing connections. However,connections are stored "as-is" in the cache. They are not "cleaned up".
</blockquote>
<p>
The ext/mysqli driver takes care of this and a few other problems surrounding the persistent connections by cleaning up things like rolling back active transactions, unlocking tables, closing prepared statements and closing handlers. The trick is in a call to the C-API function  <a href="http://dev.mysql.com/doc/refman/6.0/en/mysql-change-user.html">mysql_change_user() (= COM_CHANGE_USER)</a>.
</p>]]></description>
      <pubDate>Thu, 19 Feb 2009 09:31:33 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[TotalPHP.com: Creating a text or csv file of information from your database ]]></title>
      <guid>http://www.phpdeveloper.org/news/11542</guid>
      <link>http://www.phpdeveloper.org/news/11542</link>
      <description><![CDATA[<p>
On the TotalPHP site there's <a href="http://www.total-php.com/article/15/creating-a-text-or-csv-file-of-information-from-your-database/">a new tutorial</a> showing how to pull data from your database and export it as a CSV file that tools like Excel can read in and use.
</p>
<blockquote>
There are some occasions where you would want to export your site's information in CSV or similar text format. You might want to do this so you can view reports in a spreadsheet, or you might want an export of your product information to upload to a service like Google Products. Either way the method and end result are essentially the same.
</blockquote>
<p>
The tutorial shows how to grab the information (via the mysqli functionality in PHP5) and formatting each row with the correct values in a certain order. Finally, the entire contents are echoed back out with the correct header() to force a download on the user's browser.
</p>]]></description>
      <pubDate>Wed, 10 Dec 2008 08:47:44 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Rubayeet Islam's Blog: MySQL Prepared Statements and PHP : A small experiment]]></title>
      <guid>http://www.phpdeveloper.org/news/11317</guid>
      <link>http://www.phpdeveloper.org/news/11317</link>
      <description><![CDATA[<p>
In a <a href="http://rubayeet.wordpress.com/2008/10/07/mysql-prepared-statements-and-php-experiment/">recent post</a> to his blog <i>Rubayeet Islam</i> compared the more traditional way of running a query in MySQL versus a prepared statement with the MySQLi extension.
</p>
<blockquote>
Consider a PHP-MySQL application where the information of 1000 users is being retrieved from the database by running a for loop [...] in each iteration, the first thing the MySQL engine does is to parse the query for syntax check. Then it sets up the query and runs it. Since the query remains unchanged during each iteration(except for the value of user_id), parsing the the query each time is definitely an overhead. In such cases use of prepared statements is most convenient.
</blockquote>
<p>
He explains what prepared statements are and some of the advantages around them and includes some benchmarking examples to show the differences - about a five second jump in favor of MySQLi.
</p>]]></description>
      <pubDate>Thu, 30 Oct 2008 11:13:58 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Community News: MySQL AB Project officially supports PDO]]></title>
      <guid>http://www.phpdeveloper.org/news/8715</guid>
      <link>http://www.phpdeveloper.org/news/8715</link>
      <description><![CDATA[<p>
As <i>Alexey Zakhlestin</i> <a href="http://blog.milkfarmsoft.com/?p=68">points out</a> today, <i>Lukas Smith</i> has <a href="http://news.php.net/php.internals/32435">made the announcement</a> that the MySQL group is finally recognizing the efforts of the PDO developers and supporting them:
</p>
<blockquote>
Ok, it seems that MySQL AB is finally committing to fix up PDO_MySQL and 
to generally accept the fact that PDO is the future. Of course mysqli 
will also be actively maintained. But they will also make mysqlnd play 
nicely with PDO etc.
</blockquote>
<p>
There's budgets and time lines for the project so things are already moving along and developers to the project will soon be assigned. <i>Lukas</i> also <a href="http://news.php.net/php.internals/32435">mentions</a> updated on PHP's side - validating that the documentation for the extensions (mysql and mysqli) are up to date and correct.
</p>]]></description>
      <pubDate>Mon, 24 Sep 2007 15:07:00 -0500</pubDate>
    </item>
  </channel>
</rss>
