参数 $isConfirmed 的值可以是 null、0 或 1。当我尝试发送“null”时,PDO 正在返回一个异常。我该如何解决这个问题?
$dbHandler = $dbConnection->prepare("INSERT INTO `Group` (visitId, guideId, groupSize, isConfirmed) VALUES (:visitId, :guideId, :groupSize, :isConfirmed)");
for($i = 0; $i < count($groupId); $i++) {
$dbHandler->bindParam(":visitId", $visitId, PDO::PARAM_INT);
$dbHandler->bindParam(":guideId", $guideId, PDO::PARAM_INT);
$dbHandler->bindParam(":groupSize", $groupSize, PDO::PARAM_INT);
$dbHandler->bindParam(":isConfirmed", $isConfirmed, PDO::PARAM_INT);
$dbHandler->execute();
}