I'm trying to get data from a table in a database. I can connect to the database but when I try to select the table it says access is denied. Here is my code:
<?php
$db_UserName = "UserName"
$db_Password = "Password"
$db_Host = "123.123.123.123"
$con = mysql_connect($db_Host, $db_UserName, $db_Password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo("Connection established <br>");
}
$select = mysql_select_db("TestTable", $con);
if (!$select)
{
die("Error: " . mysql_error());
}
else
{
$result = mysql_query("SELECT * FROM TestTable");
echo ("Results: " . $result);
}
?>
The result I get is:
Connection established
Error: Access denied for user 'UserName'@'%' to database 'TestTable'
I've seen others with the same problem but I cannot seem to resolve the issue. The database is not on a local machine.