I'm completely new to php and mySQL and trying to connect to a remote database. Here's my code:-
php $con = mysql_connect("2toria.com","username","password"); if
(!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db("myTable", $con);
$result = mysql_query("SELECT * FROM Contestants");
while($row = mysql_fetch_array($result)) { echo $row['Name'];
echo "
"; }
mysql_close($con);
The database, table, username and password names are all correct (Ive changed them here for obvious reasons), but I'm getting the following error:-
Warning: mysql_connect() [function.mysql-connect]: Access denied for
user 'username'@'bluechip6.ukhost4u.com' (using password: YES) in
/home/toriaco/public_html/bigbro/index.php on line 9 Could not
connect: Access denied for user 'username'@'bluechip6.ukhost4u.com'
(using password: YES)**
Any ideas on the problem? TIA, Matt
Answer
First possible reason:
I know antagonist (a Dutch hosting service) blocks all connections that are not from localhost
for security reasons, and I don't think they are the only ones. (So always connect to localhost, not a http://...
URL!)
Second possible reason:
The password/username is wrong.
No comments:
Post a Comment