db_name = $db_name; if(!$this->db_hadnle = @mysql_connect($db_server,$db_user,$db_pass)) { trigger_error(mysql_errno($this->db_hadnle).' '.mysql_error($this->db_hadnle), ERROR); $this->db_hadnle = false; return false; } if(!@mysql_select_db($db_name,$this->db_hadnle)) { trigger_error(mysql_errno($this->db_hadnle).' '.mysql_error($this->db_hadnle), ERROR); $this->db_hadnle = false; return false; } else { mysql_query("SET NAMES 'cp1251';"); } } function query_replase($sql,$repl_arr=null) { if($repl_arr === null || $repl_arr == array()) { return $sql; } else { $sql_out = ''; $start = 0; preg_match_all('/([^\\\\]{1}\\$)/',$sql,$math,PREG_OFFSET_CAPTURE); foreach ($math[1] as $key=>$val) { $sql_out .= substr($sql, $start, $val[1]-$start+1); if(is_array($repl_arr)) { $sql_out.="'".addslashes($repl_arr[$key])."'"; } elseif($key == 0) { $sql_out .= "'".addslashes($repl_arr)."'"; } $start = $val[1]+2; } $sql_out .= substr($sql,$start); return str_replace('\\$', '$', $sql_out); } } function query($sql, $repl_arr = null) { $sql = $this->query_replase($sql, $repl_arr); $this->sql = $sql; if(!$res = mysql_query($sql, $this->db_hadnle)) { myError(E_DB, $sql, mysql_error($this->db_hadnle),mysql_errno($this->db_hadnle)); return false; } return $res; } function query_insert($sql,$repl_arr=null) { $this->query($sql,$repl_arr); return mysql_insert_id($this->db_hadnle); } function query_affected_rows($sql,$repl_arr=null) { $this->query($sql,$repl_arr); return mysql_affected_rows($this->db_hadnle); } function get_value_query($sql, $repl_arr = null) { if(!$res=$this->query($sql,$repl_arr)) { return false; } if(mysql_num_rows($res) & mysql_num_fields($res)) { return mysql_result($res,0,0); } else { return false; } } function get_array_list($sql,$repl_arr=null) { if(!$res=$this->query($sql,$repl_arr)) return false; $array=array(); while ($row = mysql_fetch_assoc($res)) { $array[]=$row; } return $array; } function getKeyValArray($sql, $replArr = null) { if(!$res = $this->query($sql, $replArr)) return false; $array=array(); while ($row = mysql_fetch_array($res)) { $array[$row[0]]=$row[1]; } return $array; } function get_affected_rows($sql,$repl_arr=null) { $this->query($sql,$repl_arr); return mysql_affected_rows($this->db_hadnle); } function get_one_line_assoc($sql,$repl_arr=null) { if(!$res=$this->query($sql,$repl_arr)) return false; return mysql_fetch_assoc($res); } function exec_query($query) { $prev = 0; $i=0; $arr=preg_split('/;[ ]*(\n|\r)/',trim($query)); foreach ($arr as $a) { if(!$this->query($a)) { return 0; } $i++; } return $i; } function get_assoc_column ($sql,$repl_arr=null) { if(!$res = $this->query($sql,$repl_arr)) return false; $arr = array(); while ($row = mysql_fetch_array($res)) { $arr[] = $row[0]; } return $arr; } } ?>
Fatal error: Class 'db_client' not found in /var/www/clients/client7/web35/web/index.php on line 9