Php 我想从Codeigniter中的SQL获取最新记录
在此过程之前,我尝试使用此代码仅显示users表,效果非常好Php 我想从Codeigniter中的SQL获取最新记录,php,mysql,codeigniter,Php,Mysql,Codeigniter,在此过程之前,我尝试使用此代码仅显示users表,效果非常好 $this->db->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer'); 我想你可以用这个: $this->db->query("SELECT * FROM tblanswers ORDER BY answerid DESC LIMIT 1")->row(); 关于这方面的更多信息,您可以在这里找到:它工
$this->db->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer');
我想你可以用这个:
$this->db->query("SELECT * FROM tblanswers ORDER BY answerid DESC LIMIT 1")->row();
关于这方面的更多信息,您可以在这里找到:它工作正常,但最好使用DB函数。像order_by()和limit()一样
$this->db
->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer')
->order_by('title', 'DESC');