When should I use MySQLi instead of MySQL?

Reasons why you should use MySQLi extension instead of the MySQL extension are many:

  1. MySQLi gives you prepared statements – a safer way of sending data to MySQL and protecting you from SQL injection. This alone should be enough for always choosing MySQLi over MySQL.
  2. MySQLi enables most of the MySQL features.
  3. MySQLi is object orientated.
  4. MySQLi supports prepared statements, transactions and multiple statements.
  5. The old MySQL extension is deprecated as of PHP 5.5.0

And there are other benefits. But mainly, you should focus on security and stabiltity – and MySQLi gives you just that.

Leave a Comment