-1
我有一個codeigniter
應用程序,我需要從datetime
數據類型的mysql字段獲得year
。我需要使用以下方法使用CI active record
來執行此操作。從MySQL的日期時間格式獲得YEAR使用codeigniter活動記錄
$this->db->select(YEAR("added_date"));
$this->db->from("news");
$this->db->order_by("added_date", "DESC");
$this->db->where('published', 1);
$this->db->distinct();
$this->db->get();
,但我得到了以下錯誤:
Call to undefined function YEAR() in /opt/lampp/htdocs/...
我用笨的2.1.x(如果需要)
哦,當然,thankx獎 – goseo