表數(shù)據(jù)
以下函數(shù)可以獲取表信息
$this->db->list_tables();
返回一個(gè)包含當(dāng)前連接數(shù)據(jù)庫(kù)中所有表名稱的數(shù)組。例如:
$tables = $this->db->list_tables();
foreach ($tables as $table)
{
?? echo $table;
}
$this->db->table_exists();
有時(shí),在對(duì)某個(gè)表執(zhí)行操作之前,使用該函數(shù)判斷指定表是否存在很有用。返回一個(gè)布爾值:TRUE/FALSE。例子:
if ($this->db->table_exists('table_name'))
{
?? // some code...
}
備注:用你所查找的表名替換 table_name
?
翻譯貢獻(xiàn)者:
analyzer, Hex, ianyang
最后修改: 2009-06-15 00:19:56