我是PDO中绑定参数和变量的新手。我想知道,是否可以在同一:id
绑定语句中以$datecreated
和变量$stmt
的形式绑定两个参数? e.g。
$stmt = $db->prepare("INSERT INTO messages (msg_subject,msg_body,doctor_id,appointment_id,msg_status, date_created) VALUES ('APPOINTMENT BOOKING CONFIRMED','Dear :name,<br/>Your appointment id: :id has been booked successfully','1',':id','1',".$datecreated.")");
$stmt->bindParam(':name', $params->name);
$stmt->bindParam(':id',$params->id);
$stmt->execute();