在这种情况下,我绑定了一个命名参数:var
。
$var = 'John Doe';
$query = $db->prepare("SELECT * from `users` where user = :var");
$query->bindParam(":var", $var);
$query->execute();
但是现在,我需要将单个命名参数绑定两次,
$var = 'John Doe';
$query = $db->prepare("SELECT * from `users` as u left join `user_group` as ug on u.user_id = ug.user_id where u.user = :var and ug.user_name = :var");
$query->bindParam(":var", $var);
$query->execute();
所以,我的问题是,我可以设置bindParam
单次或多次吗?