Difference Between mysql and mysqli

Hi all,
Yesterday I attend the telephonic interview to web development post. The interviewer ask somany questions related to PHP, MYSQL, WordPress, JavaScript, jQuery etc. Almost every questions I answerd. But the interviewer ask one important question What is the Difference Between mysql and mysqli. I can’t give the correct answer to him. Here I share useful information related to this topic.




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

  1. 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.



  2. Object-oriented interface: Mysqli support object oriented concept. The OOPs concept support only mysqli.
  3. Enhanced debugging capabilities: For save debugging information into a file using mysqli_debug(…).
  4. Prepared Statements: The mysqli prevent SQL Injection and also helps to excecute faster.
  5. 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



  6. 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.

Leave a Reply

Your email address will not be published.