<?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>Sat, 11 Feb 2012 18:18:15 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Ulf Wendel's Blog: PHP mysqli quickstart is online!]]></title>
      <guid>http://www.phpdeveloper.org/news/17392</guid>
      <link>http://www.phpdeveloper.org/news/17392</link>
      <description><![CDATA[<i>Ulf Wendel</i> has a new post to his blog pointing out <a href="http://blog.ulf-wendel.de/2012/php-mysqli-quickstart-is-online/">the new mysqli quickstart</a> that's been <a href="http://docs.php.net/manual/en/mysqli.quickstart.php">added to the PHP manual</a>.
</p>
<blockquote>
New in the PHP manual: a <a href="http://docs.php.net/manual/en/mysqli.quickstart.php">mysqli quickstart</a>. You are new to PHP but you know how to code, you know SQL, you know relational databases and MySQL? Then, I hope, this is for you. All you need is a quick overview on the concepts? The rest is in the reference section! Here you go.
</blockquote>
<p>It includes sections on:</p>
<ul>
<li><a href="http://docs.php.net/manual/en/mysqli.quickstart.connections.php">making connections</a>
<li><a href="http://docs.php.net/manual/en/mysqli.quickstart.statements.php">executing statements</a>
<li><a href="http://docs.php.net/manual/en/mysqli.quickstart.stored-procedures.php">stored procedures</a>
<li><a href="http://docs.php.net/manual/en/mysqli.quickstart.multiple-statement.php">multiple statements</a>
</ul>]]></description>
      <pubDate>Fri, 13 Jan 2012 12:13:25 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ulf Wendel's Blog: Using MySQL stored procedures with PHP mysqli]]></title>
      <guid>http://www.phpdeveloper.org/news/17088</guid>
      <link>http://www.phpdeveloper.org/news/17088</link>
      <description><![CDATA[<p>
<i>Ulf Wendel</i> has a new post today with details on <a href="http://blog.ulf-wendel.de/2011/using-mysql-stored-procedures-with-php-mysqli/">using stored procedures with mysqli</a> - not overly difficult if you know how to handle the IN, OUT and INOUT parameters. He includes a few code examples showing how to use them.
</p>
<blockquote>
Out of curiosity I asked another friend, a team lead, how things where going with their PHP MySQL project, for which they had planned to have most of their business logic in stored procedures. I got an email in reply stating something along the lines: "Our developers found that mysqli does not support stored procedures correctly. We use PDO.". Well, the existing documentation from PHP 5.0 times is not stellar, I confess. But still, that's a bit too much... it ain't that difficult. And, it works.
</blockquote>
<p>
He describes the three parameters (IN, OUT and INOUT) and gives some examples of setting/getting them from your SQL statements. They're all still set up using the <a href="http://us2.php.net/manual/en/mysqli.query.php">query method</a> on your connection as well as handling the result sets that come back and working with prepared statements.
</p>]]></description>
      <pubDate>Fri, 04 Nov 2011 11:39:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Volker Dusch's Blog: References suck! - Let's fix MySqli prepared statements!]]></title>
      <guid>http://www.phpdeveloper.org/news/16466</guid>
      <link>http://www.phpdeveloper.org/news/16466</link>
      <description><![CDATA[<p>
<i>Volker Dusch</i> has a new post to his blog looking at the use of references in PHP (or lack there of) and what we, as end users of the language, can do about it. His example looks at <a href="http://edorian.posterous.com/references-suck-lets-fix-mysqli-prepared-stat">mysqli prepared statements</a>.
</p>
<blockquote>
Even so not every PHP Developers knows WHY we don't use references pretty much every core function and every somewhat modern framework avoids them so people adapted this best practice. The leftovers in the PHP core, like sort() or str_replace(), are exceptions to the rule. So if the common consensus is, or at least 'should be', that we <a href="http://schlueters.de/blog/archives/125-Do-not-use-PHP-references.html">should not use references</a> then maybe we should start looking for places where they hurt and how we could fix them?
</blockquote>
<p>
He talks about prepared statements and one thing he sees that makes it a "hard sell" to developers needing a good way to query their databases. He points out the difference in code required between the normal MySQL calls and mysqli (hint: it's more) and shows how to use an abstraction layer to make things a bit easier. He points out the downfalls of using this approach, mainly the performance hit you get (from using his fetchAll method).
</p>]]></description>
      <pubDate>Tue, 14 Jun 2011 11:46:55 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: Escaping from the statement mess]]></title>
      <guid>http://www.phpdeveloper.org/news/16360</guid>
      <link>http://www.phpdeveloper.org/news/16360</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Johannes Schluter</i> suggests an alternative to using prepared statements in PHP applications using a database - <a href="http://schlueters.de/blog/archives/155-Escaping-from-the-statement-mess.html">creating a handler method</a> that allows for dynamic queries as well as proper escaping of values.
</p>
<blockquote>
Now prepared statements were a nice invention some 30 years ago abut they weren't meant for making things secure and so they do have some shortcomings: One issue is that preparing and executing a query adds a round-trip to the server where it then requires resources. [...] With prepared statements you first have to build the list of place holders (the exact amount of place holders (?) separated by a comma, without trailing comma)  and then bind the values and mind the offsets when having other values - this typically becomes ugly code.
</blockquote>
<p>
He includes the code for his alternative, a function using the <a href="http://php.net/mysqli">mysqli</a> extension to let you create dynamic SQL that still uses placeholders and proper escaping to prevent both SQL injection issues and resources problems caused by the multiple hops back to the database.
</p>]]></description>
      <pubDate>Thu, 19 May 2011 09:30:45 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Andrey Hristov's Blog: Replacing mysqli's Connection, Result and Statement classes]]></title>
      <guid>http://www.phpdeveloper.org/news/14770</guid>
      <link>http://www.phpdeveloper.org/news/14770</link>
      <description><![CDATA[<p>
On his blog today <i>Andrey Hristov</i> has <a href="http://hristov.com/oblog/blog/post/2010/07/08/replacing-mysqlis-connection-result-and-statement-classes/">a quick post</a> that talks about two methods to extend the functionality that the mysqli extension offers in PHP with your own custom code.
</p>
<blockquote>
Have you ever though about extending mysqli's classes. It's pretty simple to subclass the connection class mysqli. However, subclassing mysqli_result and mysqli_stmt is not so obvious, actually I though that it's even not possible. However, never say never! After discussing mysqli's OO interface for an hour yesterday [...] I found out how one can plug his own classes.
</blockquote>
<p>
Two code examples are provided - one for extending the mysqli_result and the other extending the mysql_stmt class. You can find more about these and other classes the mysqli extension has to offer in <a href="http://us3.php.net/manual/en/book.mysqli.php">this section of the PHP manual</a>.
</p>]]></description>
      <pubDate>Fri, 09 Jul 2010 10:31:03 -0500</pubDate>
    </item>
    <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>
  </channel>
</rss>

