2
我嘗試加入2個表和輸出結果:如何加入兩個表在笨
在模型:
$this->db->select('*');
$this->db->from('news');
$this->db->join('authors', 'authors.id = news.author_id');
鑑於文件:
foreach($item as $row):
echo $row->id;
endforeach;
當我運行如上面的代碼,它將從authors
表中輸出id
列。 我的問題是如何從news
表中回顯id
列?
news
和author
這兩個表都有名爲id
的列。
我想從我添加了額外的指針表的消息呼應 – miss1turn 2010-12-20 14:22:19
ID。看看是否解決了你的問題。 – 2010-12-20 14:24:01
感謝Luca.it works.is這個解決方案? – miss1turn 2010-12-20 14:25:42