My system seems to have some weird problems I can't explain. I have a following code snip that I would use to connect to and read data from the database
define('DB','products');
define('HOST','localhost');
define('DBPASS','password');
define('DBUSER','root');
define('DBTABLE','product_tb');
$conn=mysqli_connect(HOST,DBUSER,DBPASS) or die('Could not connect: ' . mysqli_error($conn));
But it always reports an error that I can't make a connection with mysqli_connect. I try running this code on another system and it works fine. Here are the two warning and an failed connection error.
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'root'@'localhost' (using password: NO) in D:\xampp\htdocs\products.php on line 7
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in D:\xampp\htdocs\products.php on line 7 Could not connect:
This happens when I test system doesn't require password, so I left the DBPASS as blank but once I use this on the real system, it fails with the exact same error, no matter whether I left out the DBPASS or not.... I thought it was cache but I restarted mysql and apache but nothing works then. Thank you if you could offer some help.