Difference between mysqli and mysql?

Possible duplicate:
Advantages of MySQLi over MySQL

I am creating a large database and wondering what is the best way to use?

I now sanitize my values ​​and avoid characters for security, but I would like to know the various benefits of these mysql queries in php?

Thanks.

+6
source share
5 answers

Use MySQLi over older MySQL functions. "I" means "improved." A list of improvements can be found in the docs .

+15
source

Why not use PDO instead? You have the advantage of prepared statements among other functions there, and this will prove to be a reasonable solution if you decide to move to another database one day.

http://php.net/manual/en/book.pdo.php

If you insist on using one of the above options, MySQLi is basically a more object oriented approach to the standard mysql extension. For the most part, they are functionally the same. If you are building an OOP-based application, MySQLi is likely to be a wiser and more consistent choice.

+2
source

First of all, you are better off using a PDO (as Lior suggested) or an intermediate layer (encoded by you) between your code and the database functions provided by PHP, so that you can easily modify mysql using mysqli or whatever, re-edit the whole code.

Unlike the differences, mysqli has more functionality (there are many new features), as well as object-oriented.

+2
source

From my point of view, the main difference (improvement) is that mysqli allows you to execute multiple queries; which, in turn, allows you to execute (and retrieve results) stored procedures with out parameters or return results.

I agree with others that using PDO is the best choice.

+1
source

For everyone who says they use PDO. Is this for prepared statements only? Since you can do prepared statements in mySQLi without PDO . Just FYI.

0
source

Source: https://habr.com/ru/post/885759/


All Articles