2016-08-14 181 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