mercredi 4 mars 2020

Laravel Query builder replacing ' into '

I have laravel query builder query where is in the where condition I have an ',

Select * from teams where name ilike ST. HELLEN'S

But when I run this query through Laravel query builder it is converted into

Select * from teams where name ilike ST. HELLEN'S

And at the end I am getting Syntax error. Anyone has any idea how to get through this issue?

I have alreadyt tried these

Select * from teams where name ilike ST. HELLEN\'S
Select * from teams where name ilike `ST. HELLEN'S`

This is the code I have:

$query = "Select * from teams where name ilike ST. HELLEN\'S"; 
$data = DB::select($query); 

Also tried:

DB::select(DB::raw($query));


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire