I am having a problem with the execution of my SQL query. Here is my code snippet...
$db = phpmotorsConnect();
$sqlSearch = "'%" . $searchTxt . "%'";
$sql = "SELECT * FROM inventory WHERE invColor LIKE :sqlSearch OR invMake LIKE :sqlSearch OR invModel LIKE
:sqlSearch OR invDescription LIKE :sqlSearch OR invPrice LIKE :sqlSearch";
$stmt = $db->prepare($sql);
// THIS LINE:
$stmt->bindValue(':sqlSearch', $sqlSearch, PDO::PARAM_STR);
$stmt->execute();
The line indicated is NOT replacing the placeholder value with the variable $sqlSearch, like we did on the account and vehicle models. Any ideas why? I've tested out the query and it works as long as there is a good value in there.
I was expecting the placeholder, :sqlSearch, to be replaced with '%%', having the search text in for the string.