HubsInfo Network

Database connection using mysqli_ (PHP and MySQL)

Database connection using mysqli_ (PHP and MySQL)
« on: June 20, 2014, 07:54:02 PM »
$db_host = 'localhost';
$db_user = 'YourUsername';
$db_pass = 'YouPassword';
$db_name = 'NameOfDB';

@$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);

if (mysqli_connect_errno()) {
 die('

Could not connect to the database

');
}

$mysqli->set_charset("utf8");