<?php
class mysql{
private $host;
private $name;
private $pass; function __construct($host,$name,$pass){
$this->host=$host;
$this->name=$name;
$this->pass=$pass;
$this->connect();
} function connect(){
mysql_connect($this->host,$this->name,$this->pass) or die (mysql_error());
}

}$db=new mysql("localhost","root","123");?>/*******************************************************************************************************
* 注:我的PHP环境用的是WampServer2.0
* 1、我设置了密码,但是我的数据库没有密码,它为什么会出现这样的提示Warning: mysql_connect() [function.mysql-* connect]: Access denied for user 'root'@'localhost' (using password: YES) in D:\Program Files\wamp\www\class\mysql_class.php on line 15
Access denied for user 'root'@'localhost' (using password: YES)* using password: YES ? 没有密码,它为什么还提示YES?* 2、我把root改成roo后为什么不有提示错误信息?* 3、把function __construct($host,$name,$pass)里的三个参数取消后,为什么不提示错误信息?*/