public function __construct(array $par " /> 巨大乳hdbbw,女教师公车痴汉在线播放,被黑人做的白浆直流

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

一個php Mysql類 可以參考學(xué)習(xí)熟悉下

復(fù)制代碼 代碼如下:
<?php
class Mysql
{
private $conn;
private $host;
private $username;
private $password;
private $dbname;
private $pconnect;
private $charset;

public function __construct(array $params = null)
{
if (!empty($params)) {
foreach ($params as $k => $v) {
$this->$k = $v;
}
}
}

public function connect()
{
$fun = $this->pconnect ? 'mysql_pconnect' : 'mysql_connect';
$this->conn = $fun($this->host, $this->username, $this->password);
$this->conn && $this->query('set names ' . $this->charset);
$this->conn && mysql_select_db($this->dbname, $this->conn);
}

public function getInstance()
{
return $this->conn;
}

public function query($sql)
{
return mysql_query($sql, $this->conn);
}

public function fetchOne($sql)
{
$data = $this->fetchRow($sql);
return $data[0];
}

public function fetchCol($sql)
{
$tmp = $this->fetchAll($sql, MYSQL_NUM);
foreach ($tmp as $v) {
$data[] = $v[0];
}
}

public function fetchRow($sql)
{
$result = $this->query($sql);
$data = mysql_fetch_row($result);
mysql_free_result($result);
return $data;
}

public function fetchAssoc($sql)
{
$result = $this->query($sql);
$data = mysql_fetch_assoc($result);
mysql_free_result($result);
return $data;
}

public function fetchAll($sql, $type = MYSQL_ASSOC)
{
$result = $this->query($sql);
while ($tmp = mysql_fetch_array($result, $type)) {
$data[] = $tmp;
}
return $data;
}

public function fetchPairs($sql)
{
$result = $this->query($sql);
while ($tmp = mysql_fetch_row($result)) {
$data[$tmp[0]] = $tmp[1];
}
return $data;

}

public function insert($table, array $bind)
{
$cols = array();
$vals = array();
foreach ($bind as $col => $val) {
$cols[] = $col;
$vals[] = $val;
unset($bind[$col]);
}
$sql = "INSERT INTO "
. $table
. ' (`' . implode('`, `', $cols) . '`) '
. 'VALUES (/'' . implode('/', /'', $vals) . '/')';

$stmt = $this->query($sql, $this->conn);
$result = $this->affectedRows();
return $result;
}

public function getLastInsertId()
{
return mysql_insert_id($this->conn);
}

public function affectedRows()
{
return mysql_affected_rows($this->conn);
}

public function update($table, array $bind, $where = '')
{
$set = array();
foreach ($bind as $col => $val) {
$set[] = '`' . $col . "` = '" . $val . "'";
}

$sql = "UPDATE `"
. $table
. '` SET ' . implode(', ', $set)
. (($where) ? " WHERE $where" : '');

$stmt = $this->query($sql, array_values($bind));
$result = $this->affectedRows();
return $result;
}

public function delete($table, $where = '')
{
/**
* Build the DELETE statement
*/
$sql = "DELETE FROM "
. $table
. (($where) ? " WHERE $where" : '');

/**
* Execute the statement and return the number of affected rows
*/
$stmt = $this->query($sql);
$result = $stmt ? mysql_affected_rows($this->conn) : $stmt;
return $result;
}

public function close()
{
$this->conn && mysql_close($this->conn);
}
}
?>

php技術(shù)一個php Mysql類 可以參考學(xué)習(xí)熟悉下,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 蜜芽无码亚洲资源网站 | 亚洲国产精品一区二区久久第 | 快播理论片 | 成人在线免费视频 | 欧美一级做a爰片免费 | 强奸美女老师 | 久久久久久免费高清电影 | 国产在线精品一区二区网站免费 | 女仆翻身大作战 | 中文字幕在线播放视频 | 久久AV国产麻豆HD真实 | 探花口爆颜射乳交日韩 | 天天躁夜夜踩很很踩2022 | 美女被爆插 | 16女下面流水不遮图免费观看 | 亚洲成年男人的天堂网 | 日本美女毛茸茸 | 国产精品久久久久久52AVAV | 野花日本大全免费观看3中文版 | 看了n遍舍不得删的黄文 | 亚洲国产韩国欧美在线不卡 | 小伙无套内射老女人 | 冠希和阿娇13分钟在线视频 | 绑着男军人的扒开内裤 | 天天狠狠弄夜夜狠狠躁·太爽了 | 国产在线一区观看 | 女人被弄到高潮叫床免 | 99热在线视频 | 天天躁日日躁狠狠躁午夜剧场 | 无人区在线日本高清免费 | 亚洲伊人久久大香线蕉综合图片 | 国产精品久久久久久熟妇吹潮软件 | 娇妻让壮男弄的流白浆 | 亚洲欧美中文日韩视频 | a在线免费观看视频 | 日本邪恶少女漫画大全 | 国产精品欧美一区二区在线看 | sm主人调教揉花蒂H SM双性精跪趴灌憋尿调教H | av视频在线免播放观看 | 撕烂衣服扒开胸罩揉爆胸 | 国产欧美亚洲综合第一页 |