How mysqli different from mysql

Mysql

Posted on 08 Jan 16 by Vickey
  1284



Mysqli extension is an improved version of Mysql. The 'i' in mysqli is for “improved”.In mysqli  many new features added. Here are some benefits of mysqli

1. Object-oriented interface

You can improve or change base mysqli class

class customSql extends mysqli {
	mysqli_report(MYSQLI_REPORT_OFF);
} 

2.Prepared Statements

It prevent SQL injections and execuation is faster then mysql

3. Multiple Statements

You can execuate multiple query in one mysqli call. This reduce the no of calls between database and the PHP server.

$connection = new mysqli($host, $user, $password, $database);
$query  = "INSERT INTO users (name,email ) VALUES('user name','test@gmail.com');";
$query  .= "INSERT INTO employee (name,email ) VALUES('employee name','employee@gmail.com');";
$result = mysqli_multi_query($connection, $query);

4.Support for Transactions

Mysqli support transactions queries.  If there is an error in process in mysqli queries it will  rolled back all queries.

5.Enhanced debugging capabilities

By using "mysqli_debug()" we can write debugging information in a file


If this post help you reduce time to develop, you can help me to maintain this website :)
www.000webhost.com