我想从Codeigniter中获取SQL的最新记录

时间:2017-06-21 15:21:14

标签: php mysql codeigniter

在此过程之前,我尝试使用此代码仅显示用户表,并且效果很好。

$this->db->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer');

2 个答案:

答案 0 :(得分:0)

我认为你可以使用它:

$this->db->query("SELECT * FROM tblanswers ORDER BY answerid DESC LIMIT 1")->row();

有关此内容的更多信息,请访问:https://www.codeigniter.com/user_guide/database/results.html

答案 1 :(得分:0)

$this->db
     ->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer')
     ->order_by('title', 'DESC');