CodeClerks

What's the difference between MySQL and MySQLi?



Write the reason you're deleting this FAQ

What's the difference between MySQL and MySQLi?

Hello friends

What's different between MySQL and MySQLi? Why use MySQLi instead of MySQL.

Thanks

Comments

Please login or sign up to leave a comment

Join
Everett
Differences between MySQL and MySQLi are as follows:
  • MySQL is deprecated in PHP v5.5.0, and removed in PHP v7, whilst MySQLi is not, should be using MySQLi or PDO
  • MySQLi is more secure, as you can use prepared statements, whilst MySQL isn't
  • Object-oriented interface
  • Support for Prepared Statements
  • Support for Multiple Statements
  • Support for Transactions
  • Enhanced debugging capabilities
  • Embedded server support

Source

Basically, there isn't much difference other than security, or being deprecated and removed. It is strongly suggested that you use MySQLi or PDO for PHP applications as newer versions of PHP will remove the ext/mysql function in the future. So if you were to upgrade to the newest version of PHP, and were to use old ext/mysql functions then the application will fail to work as intended. Then you would need to convert your ext/mysql functions into ext/mysqli functions.

It's best to start using MySQLi now, than to waste time by converting mysql to mysqli. All new PHP applications should be using MySQLi, or PDO.



Are you sure you want to delete this post?