The following code is a pretty simple select doing a like and is run a few times a week with different two character values in $cclike (surrounded by %, as in '%GA%'. Yesterday it failed unexpectedly when $cclike ended up being equal to '%CI%'. I can repeat this error as much as I want but only when the value of $cclike is equal to '%CI%'.
<? php
$stmt = $pdo->prepare("SELECT consignor_code FROM consignors WHERE store_id =:sid and consignor_code LIKE :cc ORDER BY consignor_code DESC LIMIT 1");
$stmt->execute(['sid' => $store_id, 'cc' => $cclike]);
$consignor = $stmt->fetch();
?>
Does anybody know what it is about CI that is causing this issue? Is it some form of keyword that breaks the query.
Note that I can run the query with outside the php and it works fine. i.e.,
SELECT consignor_code
FROM consignors
WHERE store_id ='001' and consignor_code LIKE '%CI%'
ORDER BY consignor_code DESC LIMIT 1;