I have item name like girl\'s bag\'s.
so query becomes like below
SELECT *
FROM tbl_product
WHERE itm_name LIKE '%girl\'s bag\'s%'
AND status = '1'
AND is_available = '1'
ORDER BY itm_id DESC
LIMIT 20
I have item with name girl\'s bag\'s. but i am not getting any result. Can anyone help , how should i format my item name to match with item in databse.
You need to escape quotes by doing two single quotes (so change
\'to''):But it would be better to use prepared staments and bind parameters to the sql, not concatenating strings to create the query.
EDIT: Based on the comment, the OP has
\'literally in the data, so the query should use\'':