News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
PDO vs. MySQLi Which Should You Use?
February 22, 2012 @ 11:58:59

On the NetTuts.com site today there's a quick tutorial comparing two of the main database access methods available to PHP developers - PDO and MySQLi - based on performance and features they each have.

When accessing a database in PHP, we have two choices: MySQLi and PDO. So what should you know before choosing one? The differences, database support, stability, and performance concerns will be outlined in this article.

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:

  • Making a new connection
  • Databases supported (PDO has drivers)
  • Named parameters
  • Object mapping
  • Security
  • Performance
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).
0 comments voice your opinion now!
pdo mysqli database interface compare feature performance


blog comments powered by Disqus

Similar Posts

Devshed: Building a PHP ORM: Deploying a Blog

Aura Blog: A Peek At Aura v2 -- Aura.Sql and ExtendedPdo

RubySource.com: Confessions of a Converted PHP Developer: Animal Abuse

Stoyan Stefanov's Blog: Reusing an existing database connection with MDB2

PHPMaster.com: Writing Custom Session Handlers


Community Events

Don't see your event here?
Let us know!


symfony podcast security release version api interview extension threedevsandamaybe opinion language community unittest introduction library voicesoftheelephpant laravel series laravel5 framework

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework