When PHP 5 and MySQL 4.1 came by, there where so many new points to include or change in the old ext/mysql that they came to the conclusion that it was better to release a new extension, basically as a way to start over and clean things up.
mysqli is the "new" extension provided in PHP5 that its designed to work and support the new features found in Mysql version 4.1.3 or above. It includes SSL connections, stronger password algorithm, prevents SQL injection, makes use of new and more efficient MySQL binary protocol and more. Overall it provides greater speed, better security and new/improved features. One of them that i like its the object-oriented interface. It said that the OOP interface is slightly slower than the procedural interface but its tiny compared for the time it saves when writing code and how much easier to read it makes it.
Mysqli OOP interface sample:
PHP Code:
<?php
# ------------------------------------------------------------
# Simple script to fetch an associative array.
# ------------------------------------------------------------
// Connect To Database
$dbh = new mysqli( "host","user","pass","database" ) or die( mysqli_error( $dbh ) );
// Query
$res = $dbh->query('SELECT * FROM table');
while ( $row = $res->fetch_assoc() )
{
/* */
}
?>
The example above can of course be achieved with regular mysql functions ( as you may see the code above is pretty similar to the old ext/mysql ) but the mysqli OOP interface is much more cleaner from a visually point of view.
Here you can see a list of methods and properties that can be used with mysqli:
PHP: mysqli - Manual
There are a good bunch of other things to mention about mysqli like multiple queries, prepared statements, the support for commit and rollback, etc. Anyways i hope this brought some light on this subject as i believe everyone should be encouraged to start using this extension.
Cheers