0

我正在使用的项目中遇到问题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 对象 ( [items:protected] => Array ( ) )

Laravel 上次查询日志

Array ( [query] => select * from x_xxwhere user_id= ? and date = ? and date<= ? [bindings] => Array ( [0] => 17 [1] => 2016-04-1 [2] => 2016- 04-30 ) [时间] => 0.69 )

在 mysql phpmyadmin 中运行我得到 15 条记录

select * from x_xxwhere user_id= 17 and date>= '2016-04-1' and date<= '2016-04-30' //15条记录在mysql中找到

4

0 回答 0