dbname = $dbname; $this->dbusername = $user; $this->dbpassword = $pass; ini_set("memory_limit","16M"); } //=== login ========================= function login($user,$pass){ $this->dbusername = $user; $this->dbpassword = $pass; } //=== execute ========================== function execute($query){ $this->db = mysql_connect( $this->dbhost, $this->dbusername, $this->dbpassword); mysql_select_db($this->dbname,$this->db); mysql_query("SET CHARACTER SET utf8_general_ci"); // mysql_query("SET CHARACTER SET utf8_unicode_ci"); mysql_query('SET COLLATION_CONNECTION=utf8_general_ci'); mysql_query("SET character_set_client=utf8_general_ci"); mysql_query("SET character_set_connection=utf8_general_ci"); mysql_query("SET character_set_results=utf8_general_ci"); $this->status = 1; $this->result = mysql_query($query) or $this->oops(); $this->rows = mysql_affected_rows(); mysql_close(); } //=== request query ========================== function query($query){ $this->db = mysql_connect( $this->dbhost, $this->dbusername, $this->dbpassword); mysql_select_db($this->dbname,$this->db); mysql_query("SET CHARACTER SET utf8"); $this->status = 1; $this->result = mysql_query($query) or $this->oops(); //... if no error create array if($this->status){ $this->makearray(); mysql_free_result($this->result); } mysql_close(); } //--- create RS array function makearray(){ //---init vars $this->rs = array(); $this->rows = 0; //---make array if (is_resource($this->result)){ while ($row=mysql_fetch_assoc($this->result)){ $this->rs[]=$row; $this->rows++; } } } //=== error handling ========================== function oops(){ $this->status = 0; $this->error = mysql_error(); } } ?>