- <?php
- /*
- * Author 墨龍
- * Time 2010年12月2日 15:50:35
- */
- $db = new mysql($db_host,$db_user,$db_password,$db_table,$db_conn,$pre,$coding);
- class mysql{
- private $db_host;
- private $db_user;
- private $db_password;
- private $db_table;
- private $db_conn; //數據庫連接標識;
- private $result; //執行query命令的結果資源標識
- private $sql; //sql執行語句
- private $pre; //數據庫表前綴
- private $coding; //數據庫編碼,GBK,UTF8,gb2312
- function __construct($db_host,$db_user,$db_password,$db_table,$db_conn,$pre,$coding){
- $this->db_host = $db_host;
- $this->db_user = $db_user;
- $this->db_password = $db_password;
- $this->db_table = $db_table;
- $this->db_conn = $db_conn;
- $this->pre = $pre;
- $this->coding = $coding;
- $this->connect();
- }
- function connect(){
- $this->db_conn = @mysql_connect($this->db_host,$this->db_user,$this->db_password) or die($this->show_error("數據庫鏈接錯誤,請檢查數據庫鏈接配置!"));
- if(!mysql_select_db($this->db_table,$this->db_conn)){
- echo "沒有找到數據表:".$this->db_table;
- }
- mysql_select_db($this->db_t