亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

direktori cari
歡迎 目錄 快速參考圖 基本信息 服務(wù)器要求 許可協(xié)議 變更記錄 關(guān)于CodeIgniter 安裝 下載 CodeIgniter 安裝指導(dǎo) 從老版本升級 疑難解答 介紹 開始 CodeIgniter 是什么? CodeIgniter 速記表 支持特性 應(yīng)用程序流程圖 模型-視圖-控制器 架構(gòu)目標(biāo) 教程 內(nèi)容提要 加載靜態(tài)內(nèi)容 創(chuàng)建新聞條目 讀取新聞條目 結(jié)束語 常規(guī)主題 CodeIgniter URL 控制器 保留字 視圖 模型 輔助函數(shù) 使用 CodeIgniter 類庫 創(chuàng)建你自己的類庫 使用 CodeIgniter 適配器 創(chuàng)建適配器 創(chuàng)建核心系統(tǒng)類 鉤子 - 擴(kuò)展框架的核心 自動裝載資源 公共函數(shù) URI 路由 錯誤處理 緩存 調(diào)試應(yīng)用程序 以CLI方式運行 管理應(yīng)用程序 處理多環(huán)境 PHP替代語法 安全 開發(fā)規(guī)范 類庫參考 基準(zhǔn)測試類 日歷類 購物車類 配置類 Email 類 加密類 文件上傳類 表單驗證詳解 FTP 類 圖像處理類 輸入類 Javascript 類 語言類 裝載類 遷移類 輸出類 分頁類 模板解析器類 安全類 Session 類 HTML 表格類 引用通告類 排版類 單元測試類 URI 類 User-Agent 類 表單驗證 XML-RPC 和 XML-RPC 服務(wù)器 Zip 編碼類 緩存適配器 適配器參考 適配器 數(shù)據(jù)庫類 Active Record 類 數(shù)據(jù)庫緩存類 自定義函數(shù)調(diào)用 數(shù)據(jù)庫配置 連接你的數(shù)據(jù)庫 數(shù)據(jù)庫快速入門例子代碼 字段數(shù)據(jù) 數(shù)據(jù)庫維護(hù)類 查詢輔助函數(shù) 數(shù)據(jù)庫類 查詢 生成查詢記錄集 表數(shù)據(jù) 事務(wù) 數(shù)據(jù)庫工具類 JavaScript類 輔助函數(shù)參考 數(shù)組輔助函數(shù) CAPTCHA 輔助函數(shù) Cookie Helper 日期輔助函數(shù) 目錄輔助函數(shù) 下載輔助函數(shù) Email 輔助函數(shù) 文件輔助函數(shù) 表單輔助函數(shù) HTML輔助函數(shù) Inflector 輔助函數(shù) 語言輔助函數(shù) 數(shù)字輔助函數(shù) 路徑輔助函數(shù) 安全輔助函數(shù) 表情輔助函數(shù) 字符串輔助函數(shù) 文本輔助函數(shù) 排版輔助函數(shù) URL 輔助函數(shù) XML 輔助函數(shù)
watak

CodeIgniter 用戶指南 版本 2.1.0

編輯文檔、查看近期更改請 登錄 或 注冊  找回密碼
查看原文

查詢輔助函數(shù)

$this->db->insert_id()


這個ID號是執(zhí)行數(shù)據(jù)插入時的ID。

$this->db->affected_rows()

Displays the number of affected rows, when doing "write\" type queries (insert, update, etc.).


當(dāng)執(zhí)行寫入操作(insert,update等)的查詢后,顯示被影響的行數(shù)。

Note: In MySQL "DELETE FROM TABLE" returns 0 affected rows. The database class has a small hack that allows it to return the correct number of affected rows. By default this hack is enabled but it can be turned off in the database driver file.


注意:在 MySQL 中“DELETE FROM TABLE”的被影響行數(shù)將會返回 0。database 類有一個小 hack 允許返回正確的被影響的行數(shù)。默認(rèn)情況下這個 hack 功能是打開的但可以在數(shù)據(jù)庫驅(qū)動文件中關(guān)閉它。

$this->db->count_all();

Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:


計算出指定表的總行數(shù)并返回。在第一個參數(shù)中寫入被提交的表名。例如: echo $this->db->count_all('my_table');

// Produces an integer, like 25

$this->db->platform()

Outputs the database platform you are running (MySQL, MS SQL, Postgres, etc...):

輸出系統(tǒng)使用的數(shù)據(jù)庫平臺(MySQL, MS SQL, Postgres……)

echo $this->db->platform();

$this->db->version()

Outputs the database version you are running:


輸出系統(tǒng)正在運行的數(shù)據(jù)庫版本號 echo $this->db->version();

$this->db->last_query();

Returns the last query that was run (the query string, not the result). Example:

返回最后運行的查詢(是查詢語句,不是查詢結(jié)果)

$str = $this->db->last_query();

// Produces: SELECT * FROM sometable....

The following two functions help simplify the process of writing database INSERTs and UPDATEs.


下面的兩個函數(shù)簡化了寫入數(shù)據(jù)庫的insert和update函數(shù)。

$this->db->insert_string();

This function simplifies the process of writing database inserts. It returns a correctly formatted SQL insert string. Example:


這個函數(shù)簡化了寫入數(shù)據(jù)庫的insert函數(shù)。它返回一個標(biāo)準(zhǔn)的SQL insert字符串。例如: $data = array('name' => $name, 'email' => $email, 'url' => $url);

$str = $this->db->insert_string('table_name', $data);

The first parameter is the table name, the second is an associative array with the data to be inserted. The above example produces:


第一個參數(shù)是表名,第二個是被插入數(shù)據(jù)的聯(lián)合數(shù)組,上面的例子生成的效果為: INSERT INTO table_name (name, email, url) VALUES ('Rick', 'rick@example.com', 'example.com')

Note: Values are automatically escaped, producing safer queries.


注解:被插入的數(shù)據(jù)會被自動轉(zhuǎn)換和過濾,生成安全的查詢語句。

$this->db->update_string();

This function simplifies the process of writing database updates. It returns a correctly formatted SQL update string. Example:


這個函數(shù)簡化了寫入數(shù)據(jù)庫的update函數(shù)。它返回一個標(biāo)準(zhǔn)的SQL update字符串。例如: $data = array('name' => $name, 'email' => $email, 'url' => $url);

$where = "author_id = 1 AND status = 'active'";

$str = $this->db->update_string('table_name', $data, $where);

The first parameter is the table name, the second is an associative array with the data to be updated, and the third parameter is the "where" clause. The above example produces:


第一個參數(shù)是表名,第二個是被更新數(shù)據(jù)的關(guān)聯(lián)數(shù)組,第三個參數(shù)是“where”參數(shù)。上面的例子生成的效果為: UPDATE table_name SET name = 'Rick', email = 'rick@example.com', url = 'example.com' WHERE author_id = 1 AND status = 'active'

Note: Values are automatically escaped, producing safer queries.


注解:被插入的數(shù)據(jù)會被自動轉(zhuǎn)換和過濾,生成安全的查詢語句。

?

翻譯貢獻(xiàn)者: analyzer, Hex, IT不倒翁, sexy22
最后修改: 2012-02-20 20:46:29
Artikel sebelumnya: Artikel seterusnya: