<?php $mysqli = @new mysqli('localhost', 'admin', 'pass', 'dbtest'); require "../../library/dhtmlsql.php"; $db = DHTMLSQL::get()->connect($mysqli); if (!$db->connected()) { exit("Unable to connect to database"); } //Sets MySQL character set and collation $db->set_charset('utf8', 'utf8_general_ci'); echo "Database connection was successful<br/><br/>";
<?php require "../../library/dhtmlsql.php"; // Connection data (server_address, database, name, poassword) $dbhost = 'localhost'; $dbname = 'dbtest'; $dbuser = '******'; $dbpass = '******'; //attempt connection to database new DHTMLSQL(); $db = DHTMLSQL::get()->connect($dbhost, $dbuser, $dbpass, $dbname); //testing for connection to database if (!$db->connected()) { exit("Unable to connect to database"); } //Sets MySQL character set and collation $db->set_charset('utf8', 'utf8_general_ci'); echo "Database connection was successful<br/><br/>";