The mysql is the old extension. The mysqli is an improvement over the old extension of mysql. The i in mysqli stands for improved . Mysqli has many advantages and features available than mysql.
Key benefits of mysqli over mysql extension
- mysqli over mysql, benefits of mysqli: Since MySQL 4.0, there is a library available that can be used to run a complete MySQL server embedded inside a program, usually a desktop application.
- Object-oriented interface: Mysqli support object oriented concept. The OOPs concept support only mysqli.
- Enhanced debugging capabilities: For save debugging information into a file using mysqli_debug(…).
- Prepared Statements: The mysqli prevent SQL Injection and also helps to excecute faster.
- Support for Transactions: This is really useful to write robust applications. It gives you the ability to write a group of SQL statements that will either be executed or all rolled back
- Multiple Statements: With this “feature”, you can execute multiple SQL queries inside only one “mysqli” call. This reduces the round trips between the database server and the PHP server
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.