find in set in laravel ? example find in set in laravel ? example laravel laravel

find in set in laravel ? example


You need to escape the call to FIND_IN_SET() using quotes:

$query = DB::table('tags_value')         ->whereRaw('FIND_IN_SET(css,Tags)')         ->get();

If you want to parameterize the column for which you search in FIND_IN_SET, then you can try something like this:

$colname = 'css'$query = DB::table('tags_value')         ->whereRaw('FIND_IN_SET(?,Tags)', [$colname])         ->get();


Try this :

->whereRaw("FIND_IN_SET('css',tags)")


DB::table('tags_value')->whereRaw("find_in_set('php',tags)")....

Note that while using find_in_set() with Laravel Eloquent .find_in_set('.$tags.',columnName). sometime we become confuse that where we need give variable and db column name.