mardi 26 février 2019

Laravel-5.6 'LIKE' in where select

I use this query and i get a error :

 $description = $request->get('description');
        if (!empty($description)){
        $description_query = Transcationhistorique::where(['sender_id' => $user_id, "%$description%", 'LIKE','description'])
            ->orWhere('receiver_id', $user_id)->get();
        }else{
            $description_query  =  "" ;
        }

and this is the error that I get :

"SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause' (SQL: select * from transcation_historique where (sender_id = 32 and 0 = %salaire% and 1 = LIKE and 2 = description) or receiver_id = 32)"

and this what really i want to run:

select * from `transcation_historique` where (`sender_id` = 32 and `description` = %salaire%) or `receiver_id` = 32)



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GKgUAr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire