解析錯誤:語法錯誤,意想不到的T_VARIABLE在/home/content/00/7882800/html/Connections/dueslogin.php上線4 試圖連接到godaddy數據庫並且由於php錯誤而無法連接。查看了代碼,無法弄清楚什麼是錯的。解析錯誤:語法錯誤,意外T_VARIABLE php(更新)
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "Squarepants.db.7882800.hostedresource.com";
$username = "Squarepants";
$dbname = "Squarepants";
//These variable values need to be changed by you before deploying
$password = "***********";
$usertable = "Spongebob";
$username = "username";
$password = "password";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($Squarepants);
//Fetching from your database table.
$query = "SELECT * FROM $usertable";
$result = mysql_query($query);
if ($result) {
while($row = mysql_fetch_array($result)) {
$name = $row["$yourfield"];
echo "Name: $name<br>";
}
}
?>
錯誤出現在Connections/dueslogin.php文件中,而不是發佈的文件。 – erisco
我發佈了Connections/dueslogin.php – user0000013