$query = $dbh->prepare("SELECT `location_id`, `name`, `location_type`, `parent_id` FROM `location` WHERE `name` LIKE '%?%' AND `location_type` = 2;");
$query = $dbh->execute(array($location));
$result = $query->fetch(PDO::FETCH_ASSOC);
So the problem I'm having is that I cannot seem to get this query to work. I'm using the exact same format for queries throughout the rest of my code and that works perfectly fine.
If I add a debug message, I cannot get past the second line. I have even tried doing a SELECT query without any parameters and I cannot get it to work.
Thanks in advance