1. Engineering
  2. Computer Science
  3. ltphp database credentials definedbserver localhost definedbusername root definedbpassword root...

Question: ltphp database credentials definedbserver localhost definedbusername root definedbpassword root...

Question details

<?php

// database credentials

define('DB_SERVER', 'localhost');

define('DB_USERNAME', 'root');

define('DB_PASSWORD', 'root');

define('DB_DATABASE', 'real_estate');

// new database connection

$db = new mysqli(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);

// check connection

if ($db->connect_errno) {

die("Connection failed: " . $db->connect_errno);

}

after i run it shows like this

Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /Applications/AMPPS/www/realestate/inc/config.php on line 9
Connection failed: 1045

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution