Updated to mySQLi extension

Adapted the source code in order to use PHP mySQLi extension instead of
the old mySQL one.