0
我得到这个错误:MySQL错误:无效的参数号
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /FondManager.class.php on line 69
当试图执行此:
$Fond_Modif = $Manager->get($id);
$Fond_Modif->setContactname($_POST['name']);
$Manager->update($Fond_Modif);
这里是关注类:
public function update(Fond $Fond)
{
$q = $this->_db->prepare('UPDATE fonds SET Name, ContactName, ContactPosition, ContactMail, ContactPhone, Website, MinTic, MaxTic WHERE id = :id');
$q->bindValue(':id', $Fond->id());
$q->bindValue(':name', $Fond->name(), PDO::PARAM_INT);
$q->bindValue(':contactname', $Fond->contactname(), PDO::PARAM_INT);
$q->bindValue(':contactposition', $Fond->contactposition(), PDO::PARAM_INT);
$q->bindValue(':contactmail', $Fond->contactmail(), PDO::PARAM_INT);
$q->bindValue(':contactphone', $Fond->contactphone(), PDO::PARAM_INT);
$q->bindValue(':website', $Fond->website(), PDO::PARAM_INT);
$q->bindValue(':mintic', $Fond->mintic(), PDO::PARAM_INT);
$q->bindValue(':maxtic', $Fond->maxtic(), PDO::PARAM_INT);
$q->execute();
}
警告:PDOStatement :: execute()[pdostatement.execute]:SQLSTATE [42000]:语法错误或访问冲突:1064您的SQL语法错误;检查与您的MySQL服务器版本对应的手册,以便在/Applications/XAMPP/xamppfiles/htdocs/JG/FondManager.class.php的第8行'MinTic ='2',MaxTic ='500''附近使用正确的语法在线79 复制你的代码,现在我得到这个错误:) –
他们不在你的查询。只有列名。并且你也缺少'=' –
非常感谢!我忘记了一些逗号! –