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[[:>:]]



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire