I've created for following simple script to connect to an associated MySQL database:
<?php
$con = mysqli_connect("localhost","username","password", "database");
if (!$con)
{
die('Could not connect: ' . mysqli_connect_error());
}
echo "test";
mysqli_close($con);
?>
Initially, this gave the error message
Fatal Error: Call to undefined function mysqli_connect()
Having googled this error message, I discovered that it meant that there was an issue which I needed to sort out with my host. I did this, and they made some changes to my account. Now however, instead of giving me the error message, it doesn't do anything at all (even if I change the login credentials to incorrect ones). No error message. Nothing. If I try to access the php file directly through a web browser (IE11), it gives the following message:
Why is this happening?
var_dump(function_exists('mysqli_connect'));
If this outputs FALSE, then it does not exists and you have no mysqli module.
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=your_db_name', 'username', 'password');
}
catch(Exception $e)
{
die('Error : '.$e->getMessage());
}
?>
Try this.