修改conn.php文件时要不要改port=3306? 买了万网服务器数据库,现在要连接它
<?phpheader("Content-type:text/html;charset=utf-8");classMySQLDB{var$host="localhost"...
<?phpheader("Content-type: text/html; charset=utf-8"); class MySQLDB{ var $host="localhost"; var $port="3306"; var $username="root"; var $pwd=""; var $db="net_edu"; var $db_encode="utf8"; var $conn=null; function db_connect(){ $this->conn=mysql_connect($this->host.":".$this->port,$this->username,$this->pwd) or die("数据库服务器连接错误".mysql_error()); mysql_select_db($this->db,$this->conn) or die("数据库访问错误".mysql_error()); mysql_query("set names ".$this->db_encode); } }
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询