我最近将我的网站(目前仍在开发中)从一台服务器移动到另一台服务器,突然间,我的PHP代码出错了。令我感到困惑的是,新服务器由同一个托管公司000 webhost(不是最可靠但免费)拥有,因此运行完全相同的软件。
<?php
//URL Data Retrieval
$uuid = $_GET['uuid'];
// MYSQL Server Connection Info
$host="..."; // Host name
$username="..."; // Mysql username
$password="..."; // Mysql password
$db_name="..."; // Database name
$conn = mysql_connect($host, $username, $password);
// MYSQL Data Retrieval
$sql ="SELECT ProductID, name, description, description2, price, saving FROM product_list WHERE ProductID ='$uuid'";
mysql_select_db($db_name);
$retval = mysql_query($sql, $conn );
if(! $retval )
{
$error = "Sorry, we could not find this in our database. Please press your browser's back button, and try again.";
die("");
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
$name = $row['name'];
$description = $row['description'];
$description2 = $row['description2'];
$price = $row['price'];
$saving = $row['saving'];
}
mysql_close($conn);
?>
代码首先从URL中获取一些数据,这些数据工作正常,它是下一部分无效的部分。
以下是错误:
Warning: mysql_connect() [function.mysql-connect]: Host '10.1.1.24' is not allowed to connect to this MySQL server in /home/a9790178/public_html/display.php on line 12
PHP Error Message
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'a9790178'@'localhost' (using password: NO) in /home/a9790178/public_html/display.php on line 17
PHP Error Message
Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/a9790178/public_html/display.php on line 17
PHP Error Message
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/a9790178/public_html/display.php on line 18
指向该网站的链接:http://discountpenguin.comyr.com/display.php?uuid=1