php - Prepared statement with Match AGAINST search has no result in Laravel
I can't get any result with this one in Laravel 8
DB::select("SELECT * FROM table WHERE MATCH(title) AGAINST('?*' in boolean mode)",[$q]);
If I do this it works
DB::select("SELECT * FROM table WHERE MATCH(title) AGAINST('test*' in boolean mode)");
Any idea how to make it work?
Answer
Solution:
You can't use quotes round a bind variable, so you need to alter the value you bind to have the extra content...
AGAINST(? in boolean mode)",[$q."*"]);
Source