function menuName()
{
$this->viewData['page_title'] = "ContentManagement Systemt!";
$this->db->where('visible', 1);
$this->db->order_by("position", "ASC");
$query = $this->db->get('subjects');
$subjects = $query->result();
foreach ($subjects as $subject)
{
echo $subject->menu_name ."<br />";
$this->db->where('subject_id', $subject->id);
$query = $this->db->get('pages');
$pages = $query->result();
foreach ($pages as $page)
{
echo $page->menu_name ."<br />";
}
}
}
爲什麼我的查詢不起作用?請告訴我。查詢在CodeIgniter中不起作用
什麼不工作?沒有結果?錯誤?意外的結果? – Ross 2010-10-11 16:01:53
是的,請提供更多詳情。例如,告訴我們會出現什麼錯誤。或者也許你的桌子結構如何。當你向我們展示代碼時很難提供幫助。 – treeface 2010-10-11 16:27:43
當我運行查詢然後只是主題菜單名稱,但不是來頁面menu_name。我的意思是第一回路正在工作,但第二回路不工作 – masud010 2010-10-11 16:37:07