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
    ]);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire