我对PHP编码很陌生,想看看是否有可能获得以下代码的帮助。显然,错误仅在第 6 行。
<?php
class DBWrapper
{
function DBWrapper($server,$db,$user,$pass)
{
$this->Server = $server;
$this->DB = $db;
$this->User = $user;
$this->Password = $pass;
mysql_connect($this->Server, $this->User, $this->password) or
die("Can't connect, please check your settings. Here is the MySQL error: ".mysql_error());
mysql_select_db($this->DB) or
die("Can't select DB, please check your settings. Here is the MySQL error: ".mysql_error());
}
我真的希望得到一些帮助。
这个:
$this->Server = $mysql3.000webhost.com;
你在这个"字符串"上没有引号,所以它被解析为:
$this->Sever = somevariable concatenate with undefined/illegal constant concatenate with undefined constant
也许
$this->Server = '$mysql3.000webhost.com';
还是什么?
$this->Server = $#####;
$this->DB = $#####;
$this->User = $######;
$this->Password = $#######;
嗯,那些不是弦吗?如果是这样,请跳过$
并将它们放入'
。
$this->Server = 'mysql3.000webhost.com';
$this->DB = 'a3206525_ezmail';
$this->User = 'a3206525_ezmail';
$this->Password = 'belfegor666';
此外,发布您的凭据是不明智的;)
最重要的建议是,阅读更多关于PHP的信息。它真的会帮助你。