由於phpmysql操作在php5.4以下被棄用而推薦使用mysqli(mysql improvement),這裡是在我原有的mysql資料庫操作類的基礎上加以改進而編寫出的mysqli資料庫操作類,整體**與mysql資料庫操作類大致相同,直接例項化db_class即可
<?php
class db_class }
public function __construct($db_url,$db_username,$db_userpassword,$db_name)
public function db_settablename($db_tablename)
public function db_setorder($str)
public function db_setlimit($start,$end)
public function db_select($typearr="",$where="")
else
if(empty($where))else
$arr=array();
$sql="select $typearr from $this->db_tablename $where $this->db_order $this->db_limit ";
$result = mysqli_query($this->db_conn,$sql);
while($row = $result->fetch_array())
return $arr; }
public function db_update($typearr,$valuearr,$where="")else
$sql.="update $this->db_tablename set ";
foreach ($typearr as $key=>$value)else
}$sql.=$where;
mysqli_query($this->db_conn,$sql); }
public function db_delete($typestr,$valuestr)
public function db_insert($typearr,$valuearr)
public function __destruct()
}
資料庫操作類
using system using system.web using system.web.ui using system.web.ui.webcontrols using system.web.ui.htmlcontrols using system.data using system.data...
資料庫操作類
資料庫配置 return array db config array 資料庫配置 db host 127.0.0.1 伺服器位址 db name tmp 資料庫名 db user root 使用者名稱 db pwd 密碼 db encode utf8 編碼 db prefix dmtx 資料庫表字首...
資料庫操作類
剛摘下來的資料庫操作類,以後再慢慢更新 using system using system.collections.generic using system.linq using system.text using system.data using system.data.sqlclient us...