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

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

CodeIgniter 用戶指南 版本 2.1.0

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

字段數(shù)據(jù)

$this->db->list_fields()

Returns an array containing the field names. This query can be called two ways:


返回一個包含字段名稱的數(shù)組。這個查詢可以用兩種方法調用:

1.您可以將表名稱提供給$this->db->list_fields()調用。 $fields = $this->db->list_fields('table_name');

foreach ($fields as $field)
{
???echo $field;
}

2.您可以將組合查詢語句傳遞給query函數(shù)執(zhí)行并返回: $query = $this->db->query('SELECT * FROM some_table');

foreach ($query->list_fields() as $field)
{
???echo $field;
}

$this->db->field_exists()

Sometimes it's helpful to know whether a particular field exists before performing an action. Returns a boolean TRUE/FALSE. Usage example:


執(zhí)行一個動作前確認字段是否存在時它就變得非常有用了。返回一個布爾值:TRUE/FALSE。實例: if ($this->db->field_exists('field_name', 'table_name'))
{
?? // some code...
}

Note: Replace field_name with the name of the column you are looking for, and replace table_name with the name of the table you are looking for.


注解:替換field_name為您要查找人字段名稱,同時替換table_name為您要查找表名。

$this->db->field_data()

Returns an array of objects containing field information.


返回一個包含字段名稱信息的數(shù)組。

Sometimes it's helpful to gather the field names or other metadata, like the column type, max length, etc.


取得字段名稱或者其它元數(shù)據(jù)時就變得非常有用了,例如列的數(shù)據(jù)類型、最大長度等。

Note: Not all databases provide meta-data.


注解:并非所有數(shù)據(jù)庫都提供元數(shù)據(jù)。

Usage example:


例子: $fields = $this->db->field_data('table_name');

foreach ($fields as $field)
{
???echo $field->name;
???echo $field->type;
???echo $field->max_length;
???echo $field->primary_key;
}

If you have run a query already you can use the result object instead of supplying the table name:


如果您想執(zhí)行一個已有的查詢時你可用返回項替換掉表格名稱: $query = $this->db->query("YOUR QUERY");
$fields = $query->field_data();

The following data is available from this function if supported by your database:


如果這個函數(shù)支持您的數(shù)據(jù)庫,它將會返回以下數(shù)據(jù):
  • name - 列名稱
  • max_length - 列的最大長度
  • primary_key - 1 如果此列被定義為主鍵
  • type - 指定列的數(shù)據(jù)類型

?

翻譯貢獻者: analyzer, Drice, Hex
最后修改: 2010-10-22 11:24:57
Previous article: Next article: