class mysql{
private $db_host;
private $db_user;
private $db_pwd;
private $db_database;
private $conn;
private $sql;
private $result;
private $coding;
private $show_error = true;
public function __construct($db_host,
$db_user, $db_pwd, $db_database, $coding =
'utf8'){
$this->db_host = $db_host;
$this->db_user = $db_user;
$this->db_pwd = $db_pwd;
$this->db_database = $db_database;
$this->coding = $coding;
$this->connect();
}
private function connect(){
$this->conn = @mysql_connect($this->
db_host,$this->db_user,$this->db_pwd);
if(!$this->conn){
if($this->show_error){
$this->show_error('
');
}
}
if(!@mysql_select_db($this->
db_database, $this->conn)){
if($this->show_error){
$this->show_error('
');
}
}
if(!@mysql_query("SET NAMES $this->
coding")){
if($this->show_error){
$this->show_error('
');