我发现了很多关于这个错误的现有问题,但它们都与我的代码情况无关,所以尽管搜索了一段时间,但我不得不开始一个新问题。
我正在用 PHP 编写 PDO 准备语句,我收到错误代码:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in...
到目前为止已经构建的查询是:
SELECT * FROM esl_comments, esl_articles WHERE esl_comments.commentSet=:esl_comments.commentSet AND esl_comments.commentSetInstanceID=:esl_comments.commentSetInstanceID AND esl_comments.commentVisible=:esl_comments.commentVisible AND esl_comments.commentID=:esl_comments.commentID;
并且数据被传递给试图执行查询的函数。我已经回应了它,它显示为:
esl_comments.commentSet - article
esl_comments.commentSetInstanceID - esl_articles.articleID
esl_comments.commentVisible - Y
esl_comments.commentID - 2
所以查询中有四个占位符,所有四个都对数据感到满意,但是当我在绑定后尝试执行查询时,它给出了上述错误。
有谁知道可能是什么原因造成的?