lundi 29 mai 2017

Laravel correct way to bind data in raw sql string

I am using ? identifier for my DB::insert() and its working great, but I am having problem for my DB::select(), the ? doesn't work.

Here's my query:

    $result = DB::select("
        SELECT `department_code`, `name` FROM `tbl_departments` 
        WHERE `department_code` LIKE '%?%' OR `name` LIKE '%?%'
    ", [
        $searchkey, $searchkey
    ]);



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

Aucun commentaire:

Enregistrer un commentaire