1. Zend_Db_Adapter
10.1.2. 添加引號防止數據庫攻擊
10.1.3. 直接查詢
10.1.4. 事務處理
10.1.5. 插入數據行
10.1.6. 更新數據行
$set = array( 'id' => 4 ); //更新的表 $table = 'test'; //更新的條件 $where = $db->quoteInto('id = ?',2); $a = $db->update($table,$set,$where);
10.1.7. 刪除數據行
//表名 $table = 'test'; //條件 $where = $db->quoteInto('id = ?',3); $a = $db->delete($table,$where);
10.1.8. 取回查詢結果
//$db->query()->fetchAll() 與 $db->fetchAll() 都是返回連續數組 //$res1 = $db->query('select * from test')->fetchAll(); //$res1 = $db->fetchAll('select * from test'); //作為關聯數組返回 //$res1 = $db->fetchAssoc('select * from test'); //取回所有結果行的第一個字段名 //$res1 = $db->fetchCol('select * from test'); //只取回第一個字段值 //$res1 = $db->fetchOne('select * from test'); //取回一個相關數組,第一個字段值為碼 // 第二個字段為值 //$res1 = $db->fetchPairs('select * from test'); //只取回結果集的第一行 $res1 = $db->fetchRow('select * from test');PHP編程
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。
新聞熱點
疑難解答