Hi, I have this message on the browser: Cannot connect to database id1776712_pms
However I checked all the codes and settings, and can not find anything wrong.
My php connection code:
function webConnect()
{ // Declare connection variables
$hostname = ‘localhost’;
$username = ‘id1776712_healthinforsys’;
$password = ‘xxx’;
$dbname = ‘id1776712_pms’;
$connection = @mysqli_connect($hostname, $username, $password) or die("Cannot connect to " . $hostname . " with username " . $username);
@mysqli_select_db($dbname, $connection) or die("Cannot connect to database " . $dbname);
return $connection;
}
$query = ‘select * from country’;
$result = mysqli_query(webConnect(), $query) or die('Query error: ’ . mysqli_error());
The above username and dbname are correct - checked on phpMyAdmin.