Reputation: 3
I am trying to learn php on my own. Things were OK till i reach DB connection.
I am using NetBeans 8.1 and had installed xampp to set up mysql and apache server. But when i try to connect to DB using
$dbPassword = "PHPpassword";
$dbUserName = "PHPuser";
$dbServer = "localhost";
$dbName = "PHPFirstDB";
$connection = new mysqli($dbServer, $dbUserName, $dbPassword, $dbName);
print_r($connection);
Ideally i should be seeing $connection details but I am not able to see anything in the script output window. I have set runas : script(run in command line)
Can anyone help me here...
Upvotes: 0
Views: 863
Reputation: 3608
Try this code, it could be possible that the error is occurring but not being displayed.
ini_set('display_errors',1);
error_reporting(E_ALL ^ E_NOTICE);
$connection = new mysqli($dbServer,$dbUserName,$dbPassword,$dbName);
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
}
print_r($connection);
Upvotes: 1