は[OK]を、ので、ここで...PDOとbindParam問題は
public function insert_cover($title, $description, $category_id, $filename)
{
if($this->category_exists($category_id)) {
$sth = $this->con->prepare('
INSERT INTO cover
(id, title, description, image, category_id, timestamp)
VALUES
(null, :title, :description, :image, :category_id, null)
');
$sth->bindParam(':title', $title, PDO::PARAM_STR);
$sth->bindParam(':description', $description, PDO::PARAM_STR);
$sth->bindParam(':image', $filename);
$sth->bindParam('::category_id', $category_id, PDO::PARAM_INT);
$sth->execute();
return true;
} else {
return false;
}
}
私のコードであり、ここで私のエラーです:私はbindParam
を使用して追加しない場合
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in /MAMP/htdocs/*****/lib/DB.class.php on line 44
それが正常に動作しますキーの配列=>値の組み合わせ
ここで何が起こっているのですか?
20分間タイプミスがあります。長い一日だった。ありがとうございました。 – GV1
そこには、それを行った! :D幸運! –