I have this sql statement:
$sql = "SELECT c.creating_user FROM cdiscount_listing AS c WHERE c.created_at > :before_not_keyword AND c.created_at < :after_not_keyword";
$query = $db->query($sql);
$query->bindParam(":before_not_keyword", $date." 23:59:59", PDO::PARAM_STR);
$query->bindParam(":after_not_keyword", $date." 00:00:00", PDO::PARAM_STR);
$query->execute();
$listings = $query->fetchAll();
Which gives the standard SQLSTATE[42000]: Syntax error or access violation
error. However, when I hardcode the param values into the query instead the error goes away. Is there a bug in PDO itself or have I missed something here?
Note that the dates are being created like this for consistency with legacy code.
The date format: 2015-07-01 00:00:00