在同一个pdo语句中绑定参数和变量

时间:2017-12-12 17:47:27

标签: php mysql pdo

我是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();

0 个答案:

没有答案