MySQL is older (not the old MySQL software, but that the set of MySQL function in PHP is older), and there are many shortcomings and deficiencies, As a result, this set of extensions was deprecated in the PHP5.5 version, removed in a new version of PHP7, with the addition of the mysqli extension and the PDO database abstraction layer.
Mysqli from the name can be seen, it and MySQL relationship must be not general, MYSQLI is the upgrade version of MySQL, in fact, with a better understanding of the contrast, such as C and c++,c language is oriented to process programming, and C + + on the basis of C new class concept and template generic what, Said a bit far away ... MySQL is a completely process-oriented function (API), and mysqli, can not only implement the process-oriented (in order to take care of the old user, basically can not modify the previous use of MySQL code, just want to use the name of the previous function of MySQL plus a letter I can, for example, Mysql_connect () to Mysqli_connect ()), Mysqli also supports object-oriented, and the Mysqli extension contains 3 classes, respectively, Mysqli,mysqli_stmt,mysql_result, Function than MySQL more than 1:30, of course, the price is that there are many methods and properties in three classes, the return type of a method in many classes is another class type, such as the mysqli in the preprocessing prepare () method return value is the mysqli_stmt type, so, A little more complicated, but, more than a few times, it will not be mistaken, I can not remember, check the manual is.
Then the database abstraction layer PDO, the name of the keyword is the abstract layer, speaking of abstraction, in the computer network protocol, the lower level protocol to the upper layer of the Protocol to provide the service, the upper class will naturally use the services provided below, but the upper layer will not control the lower level of the agreement is to do a lot of effort to complete these work , the upper level only needs to know how to use the services provided below.
PDO seems particularly advanced, a particularly good example is to write functions and call functions, such as I wrote a sorting algorithm, only need to pass an array name, you can sort the elements in an array after the programming in ascending order, now you need an ascending sort function, and you do not want to write one yourself, Then you can use my sorting function, use the time, directly pass an array name, but, you do not care about what I use the sorting method, I may use the simplest bubble sort, also may be complex quick sort, however, you do not have to care about this, as long as you can implement the function of the line.
PDO is like this, PDO can be said to be more powerful, because you can use PDO to operate on MySQL, you can also operate on the Oracle,sql server, you do not have to look at the Oracle's set of functions or the SQL Server that set of functions, You just need to be in the PDO class of the method, only need to install the corresponding database extension driver, as the above example of the sorting function, you want what function, you find what function, find the corresponding database extension drive, you only need to use the method in PDO, you can manipulate the database, As for the bottom, you don't have to care.
MySQL--->mysqli--->pdo