【发布时间】:2019-02-27 09:56:10
【问题描述】:
我使用这个查询,我得到一个错误:
$description = $request->get('description');
$description_query = Transcationhistorique::where(function ($query) use ($description, $user_id) {
$query->where('receiver_id', $user_id,'description', 'LIKE','%' . $description . '%')
->orWhere('description', 'LIKE','%' . $description . '%','sender_id', $user_id);
})->get();
这是我得到的错误:
"SQLSTATE[42S22]: 找不到列: 1054 未知列 '0' 在 'where 子句' (SQL: select * from
transcation_historiquewhere (sender_id= 32 和0= %salaire% 和1= LIKE 和2= 描述)或receiver_id= 32)”
这是我真正想要运行的:
select * from `transcation_historique` where (`sender_id` = 32 and `description` = %salaire%) or (`receiver_id` = 32 and `description` = %salaire%)
【问题讨论】:
-
是我的另一个问题
-
不一样
-
我要指出的是,您想要的选择结果与添加条件相同:所以 要解决的问题是相同的。
标签: php mysql laravel laravel-5 laravel-5.6