Database connection in MySQLi

Hi,

I am revising my old code and replacing mysql with mysqli. Here is what I previously had for a database connection:

$db = mysql_connect('host', 'username', 'password');
mysql_select_db('database');
mysql_set_charset('utf8', $db);

and here is what I have now:

$db = new mysqli('host', 'username', 'password', 'database');
$db->set_charset('utf8');

It seems to be working fine but I just wanted to ask if there are things I should be aware of in converting from mysql to mysqli.

Thanks.

Your connection is fine, where the big difference occur are in the query and fetching of data. I see you are using the OOP syntax for mysqli (good job!), also take time to read about prepare, bind_param, and execute and [url=http://us3.php.net/manual/en/mysqli.real-escape-string.php]real_escape_string if you use query