Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我想从Codeigniter中的SQL获取最新记录_Php_Mysql_Codeigniter - Fatal编程技术网

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

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(); 关于这方面的更多信息,您可以在这里找到:它工

在此过程之前,我尝试使用此代码仅显示users表,效果非常好

$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');