我有关于PDO的问题。 这个代码块工作
$MyQuery = $db->prepare("UPDATE project
SET
PeopleId=:PID,
UserId=:UID
WHERE
PeopleId=:PeopleId
AND
UserID=:UserID
AND
(
alpha = 0
OR alpha IS NULL
) LIMIT ".$Adet);
$MyQuery->bindParam(":PID", $PID, PDO::PARAM_INT);
$MyQuery->bindParam(":UID", $UID, PDO::PARAM_INT);
$MyQuery->bindParam(":PeopleId", $PeopleId, PDO::PARAM_INT);
$MyQuery->bindParam(":UserID", $UserID, PDO::PARAM_INT);
$MyQuery->execute();
但它没有用。
$MyQuery = $db->prepare("UPDATE project
SET
PeopleId=:PID,
UserId=:UID
WHERE
PeopleId=:PeopleId
AND
UserID=:UserID
AND
(
alpha = 0
OR alpha IS NULL
) LIMIT :Count");
$MyQuery->bindParam(":PID", $PID, PDO::PARAM_INT);
$MyQuery->bindParam(":UID", $UID, PDO::PARAM_INT);
$MyQuery->bindParam(":PeopleId", $PeopleId, PDO::PARAM_INT);
$MyQuery->bindParam(":UserID", $UserID, PDO::PARAM_INT);
$MyQuery->bindParam(":Count",$Count, PDO::PARAM_INT);
$MyQuery->execute();
我的错在哪里?我找不到任何东西。我想有一个错误。我将$ Count转换为Integer,但它没有再次运行。 任何人都可以帮我解决这个问题吗?
答案 0 :(得分:0)
强制$ Count var成为一个整数,
$MyQuery->bindParam(":Count", (int) $Count, PDO::PARAM_INT);
mabye trim :(在Muhammed Almaz tnx评论之后编辑:D)
$Count = trim($Count)
$MyQuery->bindParam(":Count", (int) $Count, PDO::PARAM_INT);