I want to change the database connection from MySQL to mysqli.
Here is my mysql connection code-
function mysql_dbconnect()
{
$link = @mysql_connect('localhost','root','Z!z@ef!PiV+;');
if ($link === FALSE){
$private_error = 'mysql_dbconnect: could not open connection to mysql:'
.'<li>errno:'.mysql_errno()
.'<li>error:'.mysql_error()
;
error_log($private_error,0);
die('Error: could not connect to database server.Please contact the system administrator.');
exit;
}
if (!@mysql_select_db('db')){
$private_error = 'mysql_dbconnect: could not select database:'
.'<li>errno:'.mysql_errno()
.'<li>error:'.mysql_error()
;
error_log($private_error,0);
die('Error: could not connect to database.Please contact the system administrator.');
exit;
}
return $link;
}
I am new at this. I want to change it to mysqli so that I can change the PHP version to 8.0.
Can anyone please let me know how to change it to mysqli connection?