What is the difference between MySql and MySqli? MySqli is the new and improved extension for MySql. The difference between MySql and MySqli is the way your write the code. For instance to connect to a database in MySql you would write the code something like this.
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
However MySql is becoming depreciated and will not longer be supported in future applications of PHP. In PHP5+ you will be encouraged to use the MySqli extension in your applications. TO connect to a database in MySqli you would write your code something like this.
$db = new mysqli("$host", "$username", "$password", "$dbname");
if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');
}
Difference between MySql and MySqli
The difference between MySql and MySqli is huge and MySqli gives us more Object Oriented Programming capabilities. We can handle data faster and more efficient in MySqli than we can in MySql.