在这里,我想根据我想举,但返回回到整个结果的日期得到的结果 的DATABSE看起来像这样让所有值,而不是获得搜索结果
customer_account_id customer_id date code
11 55 01-01-2017 ALI HAJI
12 55 02-01-2017 ALI HAJI
13 55 03-01-2017 ALI HAJI
125 65 01-02-2017 SHARFU
126 55 02-02-2017 ALI HAJI
127 55 03-02-2017 ALI HAJI
128 55 31-01-2017 ALI HAJI
控制器长相这样
public function report()
{
$from=$this->input->post('from_date');
$to = $this->input->post('to_date');
$from1= date('d-m-Y', strtotime($from));
$to1= date('d-m-Y', strtotime($to));
$data['result']= $this->Account_model->get_report($from1,$to1)->result();
$this->load->view('report_payment_details',$data);
}
我的模型看起来像这样
public function get_report($from1,$to1)
{
$this->db->order_by('customer_account_id','desc');
$this->db->where('date >=', $from1);
$this->db->where('date <=', $to1);
return $this->db->get('customer_accounts');
}
这里,如果我选择01-01-2017
和03-01-2017
之间的日期,那么也会显示整个结果。问题只是前两个值从日期考虑,例如,如果我考虑01-01-2017这里只有01正在考虑并保留not.please帮我解决这个问题
尝试使用打印查询'$这个 - > DB-> last_query()' –
整个结果取 –
你打印查询?执行你的mysql控制台上的打印查询 –