mardi 26 avril 2016

MySQL parenthesis not balanced

How to escape parenthesis or any characters that may break queries? I am using laravel 5.1 for making queries as:-

$books = App\Book::where('name', 'REGEXP', '[[:<:]]'.$keyword.'[[:>:]]')->get();

Here is my broken SQL log when keyword contains braces.

select * from `books` where `name` REGEXP [[:<:]]Foo (Bar[[:>:]]



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1pDEz8D
via IFTTT

Aucun commentaire:

Enregistrer un commentaire