top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the Difference Between mysql and mysqli?

+3 votes
478 views
What is the Difference Between mysql and mysqli?
posted Jan 11, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

“i” in mysqli stands for “improved” so in short mysqli is a improved version of MySQL with following advantages -

Object-oriented interface: You can still use the "old procedural" way of calling the mysql extension but the OO version groups the functions by their purpose.

Prepared Statements: Those are useful to prevent SQL injections and are executed faster.

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.

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 (usually if there is an error somewhere in the process).

Enhanced debugging capabilities: As an example, you can use "mysqli_debug(...)" to save debugging information into a file.

Embedded server support: 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.

answer Jan 11, 2016 by Salil Agrawal
Similar Questions
0 votes

I'm attempting to move away from PHP mysql functions to something newer, either mysqli or PDO.

I have read various things about them, but I'm curious at this point which would be best to learn for the present and future. I'm usually working on small to medium size projects.

I understand that PDO has an extra abstraction layer so it can work with / convert to other databases like oracle and others fairly easily, but some have said that PDO can be a bit slower the MySQLi?

So I would really like to hear opinions on the best choices of either MySQLi or PDO.

Also I'm also trying to learn OOP, so I'm looking for a very good working PDO and/or mysqli database class - to get started with, that has all the basic needs like UPDATE - INSERT - DELETE - QUERY etc. That would be very helpful.

...