HubsInfo Network
You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode. To view all forum nodes and be able to create threads/posts please register or log-in.
PHP MySQL Linux Material Design Web Hosting Online Games SimCity BuildIt

Database connection using mysqli_ (PHP and MySQL)

0 Members and 1 Guest are viewing this topic.

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