What is the difference between MySql and MySqli

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.

[code]<?php
$link = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’);
if (!$link) {
    die(‘Could not connect: ‘ . mysql_error());
}
echo ‘Connected successfully’;
mysql_close($link);
?>[/code]

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.

[code]$db = new mysqli("$host", "$username", "$password", "$dbname");
if($db->connect_errno > 0){
die(‘Unable to connect to database [‘ . $db->connect_error . ‘]’);
}[/code]

Only cool people share!

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.

 

What is the difference between MySql and MySqli was last modified: May 7th, 2015 by Maximus Mccullough
Summary
What is the difference between MySql and MySqli
Article Name
What is the difference between MySql and MySqli
Description
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.
Author
difference between MySql and MySqli

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.