I have some problems with accessing my database.
The script worked before on my localhost. I imported it in another server and the other server is giving me an access denied message.
The message that is given is: Access denied for user 'root'@'10.4.1.163' (using password: YES)
The script I am using is:
<?php
// Connect to database server
mysql_connect("localhost", "root", "password") or die (mysql_error ());
// Select database
mysql_select_db("database") or die(mysql_error());
// SQL query
$strSQL = "SELECT * FROM users WHERE user_id='". $_SESSION['USER_ID'] ."'";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
// Each row will be made into an array ($row) using mysql_fetch_array
while($row = mysql_fetch_array($rs)) {
// Write the value of the column FirstName (which is now in the array $row)
echo $row['Name'] . " ";
}
// Close the database connection
mysql_close();
?>
I also tried to change localhost to the IP address 10.4.1.163.
What is wrong with my script. I am sure that the password that I am using is right.
Does anybody know how I can fix this?