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...
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.