vendredi 7 décembre 2018

Unable to bind parameters in Laravel raw query

I'm trying to bind vars to my raw query,

$query = "SELECT 1 AS rank, 'CATEGORY' AS type, category_id AS id, name AS name
          FROM category_translations
          JOIN categories ON categories.id = category_translations.category_id
          WHERE name LIKE '%?%'";

$results = DB::select($query, ['ger']);

But I am unable to do so. I have tried by binding named params, and also using DB::raw inside DB::select without any success.

What am I doing wrong here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire