bindParam
expects a variable, to be passed by reference. date("Y-m-d H:i:s")
is clearly not a variable ;)
Try bindValue
instead.
Using the correct function will stop the domino effect of errors, and allow you to get the lastInsertId
you are seeking.
EDIT: On further review, you are trying to call lastInsertId
on your Db
wrapper class, not on the PDO
object. Try:
$pdo = $conn->dbConnect();
$stmt = $pdo->prepare($query);
// ...
$orderId = $pdo->lastInsertId();