HubsInfo Network
Login or Register to remove ads! You're browsing our forum and website as a Guest meaning you can only see a portion of the forum in read-only mode.
PHP MySQL Linux Material Design Web Hosting Online Games SimCity BuildIt

Database connection using mysqli_ (PHP and MySQL)


Database connection using mysqli_ (PHP and MySQL)
« on: June 20, 2014, 07:54:02 PM »

Example of Database connection script using PHP and MySQLi

Code: [Select]
$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('<h1>Could not connect to the database</h1>');
}

$mysqli->set_charset("utf8");
« Last Edit: March 17, 2020, 10:23:09 AM by hubsinfo »
 



Linux Ubuntu Guides Linux games - Lutris.net