2016-08-14 178 views
-2
` <?php 
/* 

Connection PHP file! Edit this to properly connect to your MySQL! 



Copyright © 2011, 2012 Quin Schurman 

This program is free software: you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version. 

This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details. 

You should have received a copy of the GNU General Public License 
along with this program. If not, see http://www.gnu.org/licenses/. 
*/ 

$_Host = "**.***.***.**"; 
$_User = "*****"; 
$_Pass = "****"; 

$_Database = "cnr"; 

$_UsersTable = "playerdata" 

//Connect to MySQL using mysql_connect() 
$_Connection = mysql_connect($_Host, $_User, $_Pass) or die('Could not connect to $_Host with $_User using password $_Pass'); 

//Select the database defined in $_Database. 
mysql_select_db($_Database); 

?>` 

使用上面的代碼一切的設置,但 在checkcredts.php 解析錯誤:語法錯誤,意外 '$ _Connection'(T_VARIABLE)在C:\ XAMPP \ htdocs中\ CNR \ connection.php上線33MySQL數據庫連接錯誤

+0

只需加上;在$ _UsersTable =「playerdata」後面'' –

+0

'$ _UsersTable =「playerdata」'...這裏你缺少一個分號 – Riad

+0

請在發佈代碼時刪除任何與問題沒有直接關係的東西。版權聲明不過是一種分心。看到(C)2012年,大概四年未修補的代碼並不令人鼓舞。 – tadman

回答

-1

嘗試:

更換

$_Connection = mysql_connect($_Host, $_User, $_Pass) or die('Could not connect to $_Host with $_User using password $_Pass'); 

@mysql_connect($_Host, $_User, $_Pass) or die('Could not connect to $_Host with $_User using password $_Pass'); 

並在$_UsersTable = "playerdata"之後加上「;」

+0

有一個語法錯誤,你看到...不是'mysql_connect'錯誤.. – Riad

+0

我很抱歉,我學習php :) –

+0

除非你有很好的理由,否則不要使用錯誤抑制'@'運算符。單引號字符串也不會內插。第三**請勿**將用戶名,主機和密碼等敏感信息放入用戶看到的錯誤消息中。這就是'死'了。 – tadman