我在项目中遇到问题我正在使用Laravel 4.2
。
有问题的代码片段。
$xx = xx::where('user_id','=',$user_id)
->where('date','>=',$first_day) //$first_day is first day of any month
->where('date','<=',$last_day)//$last_day is last day of same month
->get();
print_r($xx);die();
//records present but empty array for current month but working fine for any previous month
结果
Illuminate \ Database \ Eloquent \ Collection Object([items:protected] =&gt; Array())
Laravel上次查询日志
数组([query] =&gt; select {from
x_xx
其中user_id
=?和date
=?和date
&lt; =? [bindings] =&gt;数组([0] =&gt; 17 [1] =&gt; 2016-04-1 [2] =&gt; 2016-04-30)[时间] =&gt; 0.69)
在mysql phpmyadmin中运行我有15条记录
从
x_xx
中选择*user_id
= 17和date
&gt; =&#39; 2016-04-1&#39; 和date
&lt; =&#39; 2016-04-30&#39; //在mysql中找到15条记录