Below is my code which is written to access an external server's database. Does anyone see anything wrong with this? Thanks in advance for your help.
<?php
$host = "65.xx.xx.xx";
$user = "USER";
$password = "PASS";
$db = mysql_connect($host, $user, $password);
mysql_select_db("DATABASENAME",$db);
$result = mysql_query("SELECT * FROM Table",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=0 width=100% cellpadding=2><tr class=content-title>
<td>Name</td>
<td>Level</td>
<td>Last on</td></tr>\n";
do {
printf("<tr class=content-text>
<td nowrap>%s</td>
<td nowrap>%s</td>
<td nowrap>%s</td></tr>\n",
$myrow["Name"],
$myrow["Level"],
$myrow["LastOn"],
}
while ($myrow = mysql_fetch_array($result));
echo "</td></tr></table>\n";
}
else { echo "WTF??";
}
?>
The errors I am getting are as follows:
Warning: Can't connect to MySQL server on '65.xx.xx.xx' (111) in /www/url/test.php on line 6
Warning: MySQL Connection Failed: Can't connect to MySQL server on '65.xx.xx.xx' (111) in /www/url/test.php on line 6
Warning: Supplied argument is not a valid MySQL-Link resource in /www/url/test.php on line 7
Warning: Supplied argument is not a valid MySQL-Link resource in /www/url/test.php on line 9
Warning: Supplied argument is not a valid MySQL result resource in /www/url/test.php on line 11
WTF??