I have been using php for quite some time now and come across three different interfaces, namely: mysql_*, mysqli_* and PDOto connect to the mysql database. What I cannot understand is why there are so many interfaces for the same thing. If better, which one? or is it a matter of choosing between choosing one or the other. Is there any difference in performance and speed with each of the interfaces?
mysql_*, mysqli_* and PDO
While mysql (procedural) and mysqli (OO) are MySQL client libraries, PDO is a data access abstraction layer, it allows you to use different database drivers. The advantage of PDO is that you can theoretically change the database driver without rewriting the request code.
I recommend you check out http://php.net/manual/en/mysqli.overview.php , which briefly discusses the differences between these 3 libraries.
The MySQLi extension is a new and improved (hence i) database driver compared to MySQL. With MySQLi, you can take advantage of features such as prepared statements, as well as what fcingolani said.
PDO - , , MsSQL, MySQL PostgreSQL.
If you really only go with MySQL, you should go with it MySQLi, since it is specific to MySQL and faster than normal MySQL. If you are currently running MySQL but can do Postgree or any database in the future, PDO abstracts your database logic from the actual database, so your choice should be.
MySQLi
MySQL
MySQLi is slightly faster for some PDO operations .
Source: https://habr.com/ru/post/1761853/More articles:Javascript key codes for Alt, Ctrl and Shift - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1761849/iis-51-on-xp-classic-asp-appears-to-be-in-single-threaded-mode&usg=ALkJrhhpwEgY7oN0ZXQ_b0bKpIhd4MPUpwСоздание массива одного значения - arraysIPhone Drag Button Grid - objective-cHow can I get ContextMenuStrip to show NotifyIcon with the left mouse button? - c #C # HttpHandler Path and SSL - c #How to manually trigger the MouseMove event for a stationary mouse - c #Должен ли я освободить объект NSError для NSFileManager copyItemAtPath: toPath: error:? - memory-managementMagento: changing a product name or description that does not appear in the frontend - magentoDatabase design help: whose child is it anyway - sqlAll Articles