I have a SQL query that looks for a user by using a address and by using a city.
The address part uses a WHERE
operator but the city uses a LIKE
operator. If I remove the Like operator and just leave the WHERE
operator for the address, it works. But once I add the LIKE
operator to compare the city, I get nothing, no errors or anything just nothing is returned.
Here is my code, thank you in advance:
$stmtCont = $connection->prepare(
"SELECT * FROM `mycontacts` WHERE `CustomerAddress` = ? AND `CustomerState` LIKE ?");
$stmtCont->execute(array($scannedAddress, '$scannedCity%'"));
$customerResult = $stmtCont->fetchAll();
print_r($customerResult);