-1
在此過程之前,我嘗試使用此代碼顯示僅用戶表,它工作得很好。我想要從Codeigniter中的SQL中獲取最新記錄
$this->db->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer');
在此過程之前,我嘗試使用此代碼顯示僅用戶表,它工作得很好。我想要從Codeigniter中的SQL中獲取最新記錄
$this->db->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer');
我認爲你可以這樣做:
$this->db->query("SELECT * FROM tblanswers ORDER BY answerid DESC LIMIT 1")->row();
更多關於這一點,你可以在這裏找到:https://www.codeigniter.com/user_guide/database/results.html
$this->db
->join('tablename', 'tblanswers.answerid = credentials.cid', 'right outer')
->order_by('title', 'DESC');
它工作正常,但它能夠更好地使用DB函數。像order_by()和limit() –