0
返回查詢結果作爲一個數組我有表(TAG).. 我想選擇在此表中的所有標籤,並返回它作爲一個數組,其中TAG_ID =指數 和TAG_NAME =值 這樣的陣列如何在笨
array(
3 => 'Hazel Grouse',
4 => 'Common Quail',
5 => 'Common Pheasant',
6 => 'Northern Shoveler',
7 => 'Greylag Goose',
8 => 'Barnacle Goose',
9 => 'Lesser Spotted Woodpecker',
10 => 'Eurasian Pygmy-Owl',
11 => 'Dunlin',
13 => 'Black Scoter',
)
標籤返回這樣多d陣列
Array
(
[0] => Array
(
[tag_id] => 3
[tag_name] => Hazel Grouse
)
[1] => Array
(
[tag_id] => 4
[tag_name] => Common Quail
)
這是查詢代碼
function get_alltags() {
$this->db->select('tag_id');
$this->db->select('tag_name');
$result = $this->db->get('d_tag');
return $result->result_array();
}
$alltags = $this->tag->get_alltags();
echo "<pre>";
print_r($alltags);
echo "</pre>";
exit;