find in set in laravel ? example

南楼画角 提交于 2019-11-29 07:03:28

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)")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!