当我运行包含此代码的函数时,我返回null。任何人都可以看到我的问题吗?
$statement = $connect->prepare("UPDATE pages " .
"SET " .
"pageTitle = :pageTitle, " .
"pageSubTitle = :pageSubTitle, " .
"pageContent = :pageContent, " .
"pageMetaKeywords = :pageMetaKeywords, " .
"pageMetaDescription = :pageMetaDescription, " .
"pageDateUpdated = :pageDateUpdated " .
"WHERE " .
"pageID = :pageID");
$array = array(
"pageTitle" => $_POST["pageTitle"],
"pageSubTitle" => $_POST["pageSubTitle"],
"pageContent" => $_POST["pageTitle"],
"pageMetaKeywords" => $_POST["pageContent"],
"pageMetaDescription" => $_POST["pageMetaDescription"],
"pageDateUpdated" => $_POST["pageDateUpdated"],
"pageID" => $_POST["pageID"]
);
$result = $statement->execute($array);
答案 0 :(得分:4)
您通过阵列传入的参数不正确。您还需要在:
前面添加前缀:
$array = array(
":pageTitle" => $_POST["pageTitle"],
^--- required