MySQL DB连接错误

时间:2016-08-14 08:52:54

标签: php mysql

`    <?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上 解析错误:语法错误,第33行的C:\ xampp \ htdocs \ cnr \ connection.php中的意外'$ _Connection'(T_VARIABLE)

1 个答案:

答案 0 :(得分:-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"

之后添加“;”