Home  >  Article  >  Backend Development  >  What are the differences between MySQL, MySQLi and PDO in php?

What are the differences between MySQL, MySQLi and PDO in php?

coldplay.xixi
coldplay.xixiOriginal
2020-07-01 14:51:403470browse

The differences between MySQL, MySQLi and PDO in php are: 1. mysql is a non-persistent connection function and mysqli is a permanent connection function; 2. mysqli is a new function library provided by php5, [i] means improvement, and The execution speed is faster and safer; 3. PDO supports more advanced DB feature operations.

What are the differences between MySQL, MySQLi and PDO in php?

The differences between MySQL, MySQLi and PDO in php are:

1. MySQL extension of PHP

  • #Design and develop early extensions that allow PHP applications to interact with MySQL databases. The mysql extension provides a procedure-oriented interface;

  • and is designed for MySQL4.1.3 or earlier. Therefore, although this extension can interact with MySQL 4.1.3 or newer database servers, it does not support some features provided by later MySQL servers.

  • 2. PHP’s mysqli extension

mysqli extension, which we sometimes call MySQL enhanced extension, can be used For using the new advanced features in MySQL 4.1.3 or later;

  • mysqli extension is included in PHP 5 and later versions;

  • mysqli Extensions have a series of advantages. Compared with MySQL extensions, the main improvements are: object-oriented interface, prepared statement support, multi-statement execution support, transaction support, enhanced debugging capabilities, and embedded service support.

  • 3. PHP Data Object (PDO)

PDO is truly a unified interface database operation implemented at the bottom layer Interface

  • PDO supports more advanced DB feature operations, such as storage procedure scheduling, etc., which is not supported by the mysql native library.

  • PDO is the official PECL library of PHP. Its compatibility and stability must be higher than MySQL Extension. You can directly use the pecl upgrade pdo command to upgrade.

  • Related learning recommendations:
  • PHP programming from entry to proficiency

The above is the detailed content of What are the differences between MySQL, MySQLi and PDO in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn