无法从查询中获取数据,也不知道我错在哪里。
public function downloadOrderDailyReport() {
//$this->load->helper('date');
$timestamp = date("Y-m-d");
$this->db->select("O.created, O.paymentMethod,B.SKU as sku, B.name as Bname, B.author as authors, B.edition,B.MRP as mrp, OD.status as order_status");
$this->db->from("orders AS O");
$this->db->join("users AS U", 'O.userid=U.id');
$this->db->join("orderDetail AS OD","O.parentId=OD.orderId",'LEFT');
$this->db->join("books AS B","OD.bookId=B.id",'LEFT');
$this->db->where("O.parentId !=", NULL);
$this->db->where(date('O.created'), $timestamp);
$query = $this->db->get();
return $orders = $query && $query->num_rows() ? $query->result() : [];
}
我的专栏日期格式是 - 2018-02-06 14:29:02 我需要比较今天的日期而不是时间。当删除日期比较时,它工作正常。
答案 0 :(得分:0)
在mysql中强制O.created
到日期(请注意引用安置仅适用于date(O.created)
的{{1}}):
O.created