【发布时间】:2010-12-20 14:16:29
【问题描述】:
我尝试加入 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 的列。
【问题讨论】:
标签: php sql codeigniter join