Can't search contain underscore (string)
Can't search contain underscore (string)
dheiro
Posts: 2Questions: 0Answers: 0
Hi, i use server side using ajax, when i search with underscore keyword (_) it result no record fount.
but i'm run manual query is work fine in mysql with LIKE
and use IgnitedDatatables for codeigniter
Best regard,
Thanks
This discussion has been closed.
Replies
If you are using server-side processing, this is a server-side issue, since the filtering is done there. Specifically in this case an underscore in an SQL wildcard means "any character". The server-side script (IgnitedDatatables in this case) would need to escape the underscore.
Allan
Thanks for the answer, im solving this issue by remove escape_like_str in codeigniter library, but result not accurate.
Are you asking the author of IgnitedDatatables about this?
2 years later, but this may be helpful to anyone with the same issue. Using Ignited Tables v 2.0.1 <beta>, you will need to edit the LIKE lines in the get_filtering() method from :
to:
https://www.codeigniter.com/userguide3/database/queries.html explains the reason:
"The escape_like_str() method uses ‘!’ (exclamation mark) to escape special characters for LIKE conditions. Because this method escapes partial strings that you would wrap in quotes yourself, it cannot automatically add the ESCAPE '!' condition for you, and so you’ll have to manually do that."