HubsInfo Network

General discussions => Servers and Networking [IT & Datacenter] => PHP => Topic started by: Slowloris on June 20, 2014, 07:54:02 PM

Title: Database connection using mysqli_ (PHP and MySQL)
Post by: Slowloris 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");