2012-10-28 127 views
1

解析錯誤:語法錯誤,意想不到的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>"; 
      } 
     } 

?>

+2

錯誤出現在Connections/dueslogin.php文件中,而不是發佈的文件。 – erisco

+0

我發佈了Connections/dueslogin.php – user0000013

回答

1

我能夠編譯我的計算機上運行此腳本沒有任何語法錯誤。

$ php yourcodecopiedandpasted.php 
$ php -l yourcodecopiedandpasted.php 
No syntax errors detected in foo.php 
$ php --version 
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18) 
Copyright (c) 1997-2012 The PHP Group 
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies 
1

4號線應該是從所包含的文件Connections/dueslogin.php

您可能需要張貼這樣我們就可以檢查什麼是錯。目前的文件是好的,似乎沒有任何錯誤。

+0

我發佈了Connections/dueslogin.php – user0000013

相關問題