向書本學(xué)習(xí),還要向?qū)嵺`學(xué)習(xí)、向生活學(xué)習(xí)。消化已有知識(shí),
而且要力求有所發(fā)現(xiàn)、有所發(fā)明、有所創(chuàng)造
2019/4/2 8:38:25
view sourceprint?01.<!--? class mysql
{
private $host;
private $user;
private $pass;
private $database;
private $charset;
function __construct($host,$user,$pass,$database,$charset)
{
$this--->host=$host;
$this->user=$user;
$this->pass=$pass;
$this->database=$database;
$this->charset=$charset;
$this->connect();
}
private function connect()//連接函數(shù)
{
mysql_connect($this->host,$this->user,$this->pass) or die ("連接數(shù)據(jù)庫(kù)服務(wù)器失敗!");
mysql_select_db($this->database) or die ("連接數(shù)據(jù)庫(kù)失敗!");
mysql_query("set names $this->charset");
}
function select($sql,$tab,$col,$value)//選擇函數(shù)
{
$select=mysql_query("select $sql from $tab where $col=$value");
$row=mysql_fetch_array($select);
return $row;
}
function insert($tab,$col,$value)//插入數(shù)據(jù)函數(shù)
{
mysql_query("INSERT INTO $tab($col)values($value)");
}
function update($tab,$col,$new_value,$colm,$value)//更新數(shù)據(jù)函數(shù)
{
mysql_query("UPDATE $tab SET $col=$new_value where $colm=$value");
}
function delete($tab,$col,$value)//刪除數(shù)據(jù)函數(shù)
{
mysql_query("DELETE FROM $tab where $col=$value");
}
function close()//關(guān)閉連接函數(shù)
{
mysql_close();
}
}
//$mysql=new mysql("127.0.0.1","root","120360150","test","gbk");連接數(shù)據(jù)庫(kù)
//$sql=$mysql->select("*","admin","id","3");//選擇數(shù)據(jù)
//print_r($sql);//打印返回的數(shù)組
//$mysql->insert("admin","user_name,user_pass","'123','123'");插入數(shù)據(jù)
//$mysql->update("admin","user_pass","22","id","3");更新數(shù)據(jù)
//$mysql->delete("admin","id","4");刪除數(shù)據(jù)
//$mysql->close();關(guān)閉連接
?>
深圳市南山區(qū)南山街道南海大道西桂廟路北陽(yáng)光華藝大廈1棟4F、4G-04
咨詢電話:136 8237 6272
大客戶咨詢:139 0290 5075
業(yè)務(wù)QQ:195006118
技術(shù)QQ:179981967
深圳精銳軟件 深圳APP開(kāi)發(fā) 深圳小程序開(kāi)發(fā) 深圳微信開(kāi)發(fā) 深圳APP制作 深圳營(yíng)銷推廣 深圳網(wǎng)站建設(shè) 深圳游戲開(kāi)發(fā)
客戶案列
新聞資訊
資質(zhì)榮譽(yù)
團(tuán)隊(duì)風(fēng)采
項(xiàng)目進(jìn)度查詢
售前QQ咨詢
QQ溝通 項(xiàng)目QQ溝通