<?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>Fri, 24 May 2013 23:03:43 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Avoid the Original MySQL Extension, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/19188</guid>
      <link>http://www.phpdeveloper.org/news/19188</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new post, the first in a series, about <a href="http://phpmaster.com/avoid-the-original-mysql-extension-1/">avoiding the original MySQL extension</a> in favor of what <a href="http://php.net/mysqli">mysqli</a> has to offer. The cover some of the basics of the extension and include code showing its use.
</p>
<blockquote>
Experienced developers eschew the original MySQL extension because of its abandoned status in PHP. Nascent web developers, however, may be completely oblivious to its dormant past and dying future. [...] It is therefore the intention of this two-part article to raise awareness among developers who still use the MySQL extension, inform them of its problems, and to help them switch over to an alternative extension.
</blockquote>
<p>
They start with a brief look at the "what's wrong" with the MySQL extension (including its upcoming deprecation). The article then gets into the basics of MySQLi and how to do things like make a connection and run a few queries. There's also a bit about prepared statements and the built-in ability to do "multi-queries" (complete with rollbacks).
</p>]]></description>
      <pubDate>Fri, 15 Feb 2013 11:13:29 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Jones: How (and when) to move users to mysqli and PDO_MYSQL?]]></title>
      <guid>http://www.phpdeveloper.org/news/18803</guid>
      <link>http://www.phpdeveloper.org/news/18803</link>
      <description><![CDATA[<p>
Related to a recent discussion on the <a href="http://news.php.net/php.internals">php.internals</a> mailing list, <i>Chris Jones</i> has <a href="https://blogs.oracle.com/opal/entry/how_and_when_to_move">posted about moving away from the MySQL extension</a> in favor of the MySQLi functionality and the effort bubbling up to make the old functionality <a href="https://wiki.php.net/rfc/mysql_deprecation">deprecated</a>.
</p>
<blockquote>
An important discussion on the PHP "internals" development mailing list is taking place. It's one that you should take some note of. It concerns the next step in transitioning PHP applications away from the very old mysql extension and towards adopting the much better mysqli extension or PDO_MYSQL driver for PDO. This would allow the mysql extension to, at some as-yet undetermined time in the future, be removed.
</blockquote>
<p>
He links to a <a href="https://wiki.php.net/rfc/mysql_deprecation">RFC</a> that's been posted to help promote and push this idea forward with mentions of the "carrot" and "stick" methods for pushing users towards <a href="http://php.net/mysqli">mysqli</a>.
</p>
<blockquote>
As always, there is a lot of guesswork going on as to what MySQL APIs are in current use by PHP applications, how those applications are deployed, and what their upgrade cycle is. [...] I want to repeat that no time frame for the eventual removal of the mysql extension is set. I expect it to be some years away.
</blockquote>]]></description>
      <pubDate>Mon, 26 Nov 2012 11:04:25 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Thilanka Kaushalya's Blog: How to use Mysql Transactions with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17701</guid>
      <link>http://www.phpdeveloper.org/news/17701</link>
      <description><![CDATA[<p>
In <a href="http://coders-view.blogspot.com/2012/03/how-to-use-mysql-transactions-with-php.html">this recent post</a> to his blog <i>Thilanka Kaushalya</i> shows how to use transactions in MySQL databases (using <a href="http://php.net/mysqli">mysqli</a>
</p>
<blockquote>
Web applications are more popular today than ever with the increasing number of internet users. Most of the standard alone applications converted as web based applications or at least they try to provide a web interface for users. PHP and Mysql are two leading technologies which allow uses on rapid development of web based systems. "Transaction" is a powerful concept which comes with Mysql 4.0 and above versions. Lets explore that.
</blockquote>
<p>
He introduces the concept of transactions first, providing an example of a bank transfer between two individuals. He uses this to create a simple code sample that turns off the autocommit for the connection (using <a href="http://php.net/mysqli_autocommit">mysqli_autocommit</a> set to false)  and running the SQL in order before the commit. He also includes an example of using the rollback function to return the data back to its original state if there's an error.
</p>]]></description>
      <pubDate>Tue, 20 Mar 2012 13:04:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: PDO vs. MySQLi: Which Should You Use?]]></title>
      <guid>http://www.phpdeveloper.org/news/17572</guid>
      <link>http://www.phpdeveloper.org/news/17572</link>
      <description><![CDATA[<p>
On the NetTuts.com site today there's <a href="http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/">a quick tutorial</a> comparing two of the main database access methods available to PHP developers - PDO and MySQLi - based on performance and features they each have.
</p>
<blockquote>
When accessing a database in PHP, we have two choices: <a href="http://www.php.net/manual/en/book.mysqli.php">MySQLi</a> and <a href="http://www.php.net/manual/en/book.mysqli.php">PDO</a>. So what should you know before choosing one? The differences, database support, stability, and performance concerns will be outlined in this article.
</blockquote>
<p>
The article starts with a summary of what each of the tools offers as far as features, things like the API to work with the interface, difficulty of making connections, use of prepared statements and performance. This is followed by a few code examples showing the same actions on each side:
</p>
<ul>
<li>Making a new connection
<li>Databases supported (PDO has drivers)
<li>Named parameters
<li>Object mapping
<li>Security
<li>Performance
</ul>
<blockquote>
Ultimately, PDO wins this battle with ease. With support for twelve different database drivers (eighteen different databases!) and named parameters, we can ignore the small performance loss, and get used to its API. From a security standpoint, both of them are safe as long as the developer uses them the way they are supposed to be used (read: prepared statements).
</blockquote>]]></description>
      <pubDate>Wed, 22 Feb 2012 11:58:59 -0600</pubDate>
    </item>
    <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>
  </channel>
</rss>
