<?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, 25 May 2013 13:09:23 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Anthony Ferrara: Programming With Anthony - Prepared Statements]]></title>
      <guid>http://www.phpdeveloper.org/news/18887</guid>
      <link>http://www.phpdeveloper.org/news/18887</link>
      <description><![CDATA[<p>
<i>Anthony Ferrara</i> has posted about the latest installation in his video tutorial series he's been producing on various programming topics. In <a href="http://blog.ircmaxell.com/2012/12/programming-with-anthony-prepared.html">this latest video</a> he covers the use of prepared statements in your database interactions.
</p>
<blockquote>
The fourth video in the <a href="http://blog.ircmaxell.com/search/label/Programming%20With%20Anthony">Programming With Anthony series</a> is live! In this video, we'll explore the basic principles of prepared statements, and why you should use them instead of using escaped input directly in queries.
</blockquote>
<p>
You can watch this latest video <a href="http://www.youtube.com/watch?v=nLinqtCfhKY">over on YouTube</a>. You can also check out the previous videos in the series while you're there covering <a href="https://www.youtube.com/watch?v=CV4vPsEizJM">paradigms</a>, <a href="https://www.youtube.com/watch?v=RLmuFlDygn0">encryption</a> and <a href="https://www.youtube.com/watch?v=_YZIBWQr_yk">references</a>.
</p>]]></description>
      <pubDate>Thu, 13 Dec 2012 11:50:22 -0600</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[NETTUTS.com: The Problem with PHP's Prepared Statements ]]></title>
      <guid>http://www.phpdeveloper.org/news/14925</guid>
      <link>http://www.phpdeveloper.org/news/14925</link>
      <description><![CDATA[<p>
On NETTUTS.com there's <a href="http://net.tutsplus.com/tutorials/php/the-problem-with-phps-prepared-statements/">a new tutorial</a> talking about the problem with PHP's prepared statements, mainly due to their flexibility.
</p>
<blockquote>
There are a couple issues that appear to make these methods less flexible than we'd hope. For one, we must utilize the bind_result  method, and pass in a specific number of variables. However, what happens when this code is within a class, and we won't immediately know how many variables to pass? Luckily, there's a solution! I'll show you what it is in today's video tutorial. 
</blockquote>
<p>
The tutorial is <a href="http://net.tutsplus.com/tutorials/php/the-problem-with-phps-prepared-statements/">screencast</a> but they've also included the full code ready for cut and pasting into your favorite editor of choice.
</p>]]></description>
      <pubDate>Mon, 09 Aug 2010 10:09:01 -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[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[Internet Super Hero Blog: PDO_MYSQLND: The new features of PDO_MYSQL in PHP 5.3]]></title>
      <guid>http://www.phpdeveloper.org/news/10699</guid>
      <link>http://www.phpdeveloper.org/news/10699</link>
      <description><![CDATA[<p>
On the Internet Super Hero blog, they take <a href="http://blog.ulf-wendel.de/?p=193">a quick look</a> at what's new in the MySQL native driver version that will be included in the upcoming PHP version, PHP 5.3.
</p>
<blockquote>
PDO_MYSQLND is in the <a href="http://cvs.php.net/viewvc.cgi/php-src/">PHP CVS</a> repository at <a href="http://php.net/">php.net</a>: <a href="http://www.php.net/pdo_mysql">PDO_MYSQL</a> has been patched (PHP 5.3, PHP 6.0). Try out PDO_MYSQL with the MySQL native driver for PHP (mysqlnd). Its has new features. 
</blockquote>
<p>
They do a short recap of what the native driver libraries are all about and some of the advantages to using them. They look at some of the "memory tricks" supported by the driver and a look at the prepared statement and procedure support.
</p>]]></description>
      <pubDate>Mon, 28 Jul 2008 14:35:19 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Charles Rowe's Blog: The Four Major Benefits of MySQLi]]></title>
      <guid>http://www.phpdeveloper.org/news/8078</guid>
      <link>http://www.phpdeveloper.org/news/8078</link>
      <description><![CDATA[<p>
<i>Charles Rowe</i> shares <a href="http://www.charlesrowe.com/2007/06/15/the-four-major-benefits-of-mysqli/">four reasons/benefits</a> he's come up with that should make you think about choosing MySQLi over the normal MySQL libraries for PHP for your application.
</p>
<blockquote>
There still seems to be a lot of confusion over the differences between the two extensions despite the length of time that mysqli has been in the wild. I wanted to briefly review the four major benefits of mysqli.
</blockquote>
<p>
Here's <a href="http://www.charlesrowe.com/2007/06/15/the-four-major-benefits-of-mysqli/">the list</a>
</p>
<ul>
<li>Prepared Statements
<li>Secure MySQL connections
<li>Multi query
<li>Object Oriented Interface
</ul>
<p>
He also includes a few more links to further information (besides the explanation for each of the topics listed above) including <a href="http://devzone.zend.com/node/view/id/686">an article</a> from the Zend Developer Zone and <a href="http://forge.mysql.com/wiki/Converting_to_MySQLi">a tutorial</a> covering making the switch to MySQLi.
</p>]]></description>
      <pubDate>Tue, 19 Jun 2007 11:03:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Working with Prepared Queries with PDO Objects in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/8022</guid>
      <link>http://www.phpdeveloper.org/news/8022</link>
      <description><![CDATA[<p>
DevShed concludes their series looking at the use of PDO objects in PHP5 with <a href="http://www.devshed.com/c/a/PHP/Working-with-Prepared-Queries-with-PDO-Objects-in-PHP-5/">this last tutorial</a> focusing on the use of prepared queries in your PHP application.
</p>
<blockquote>
In this last tutorial in the series I'm going to show you how to run prepared queries, but in this case we're going to include named parameters into them. Additionally, I'm going to take a quick look at some additional methods bundled with this extension. These new methods can be really useful for working with transactions, in case you want to use this feature with the database system of your choice.
</blockquote>
<p>
They <a href="http://www.devshed.com/c/a/PHP/Working-with-Prepared-Queries-with-PDO-Objects-in-PHP-5/">start with</a> a simple approach to using prepared queries before moving on to an alternate method - binding parameters to the query via bindParam. They wrap up the article with a look at using transactions, both commits and rollbacks.
</p>]]></description>
      <pubDate>Mon, 11 Jun 2007 13:21:00 -0500</pubDate>
    </item>
  </channel>
</rss>
