Records which contain an ampersand (&
) are not returned by MySQL (connected to via PHP), but the same query works fine in phpMyAdmin. I am not sure if it is a collate/charset problem. Here is the sample query:
SELECT distinct(pcs.shop_name) AS shopName
FROM shops AS ps
LEFT JOIN category_shop AS cs
ON ps.shop_id = cs.shop_id
WHERE 1=1
AND (ps.shop_name LIKE '%P&G%')
AND ps.is_active!=2
ORDER BY ps.shop_display_name ASC
The shop_name
I am trying to search for is P&G
.