您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysqli 类(无 事务 预编译)

2025/3/25 2:33:48发布21次查看
host=isset($arr['host'])?$arr['host']:'localhost'; $this->user=isset($arr['$password'])?$arr['user']:'root'; $this->password=isset($arr['password'])?$arr['password']:'759114'; $this->charset=isset($arr['charset'])?$arr['charset']:'utf8'; $this->dbname=isset($arr['dbname'])?$arr['dbname']:'project'; $this->mysqli= new mysqli($this->host,$this->user,$this->password,$this->dbname); } #对sql语句进行判断 private function exec($sql){ if(!($this->mysqli->query($sql))){ die($this->mysqli->error); #错误处理 } return $this->mysqli->query($sql); } #数据的操作 public function db_delete($sql){ $this->exec($sql); echo 您的sql语句错误:
; #执行exec() return $this->mysqli->affected_rows; #获取受影响的行数 } #数据更新操作 public function db_update($sql){ $this->exec($sql); #执行exec() return $this->mysqli->affected_rows; #获取受影响的行数 } #插入操作 public function db_insert($sql){ $res = $this->exec($sql); #执行exec() return $this->mysqli->affected_rows; #获取受影响的行数 } #获取单条数据 public function db_getone($sql){ $res = $this->exec($sql); return $res = $res->fetch_assoc(); } #获取多条数据 public function db_getall($sql){ $res = $this->exec($sql); return $res->fetch_all(); }}
以上就介绍了mysqli 类(无 事务 预编译),包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product