I'll try asking this again but without typing mistakes.... I'm connecting using MySQLi and using intentionally bad connection variables to trigger an error.
Working as expected:
$conn = mysqli_connect("localhost","x","x","x");
if (mysqli_connect_errno()) {
echo "Couldn't establish database connection blah blah";
}
This should work exactly the same, but it showing a "Can't fetch MySQLi" warning:
$conn = new mysqli("localhost","x","x","x");
if ($conn->connect_errno) {
echo "Couldn't establish database connection blah blah";
}
Both methods are fine when the connection details are good, although that isn't the point.