准备好的语句帮助,变量数量与准备好的语句中的参数数量不匹配
我收到此错误:变量数量与准备好的语句中的参数数量不匹配 每次我运行这段代码时:
$dbh = new mysqli("localhost", "***", "***", "pics");
$stmt = $dbh->prepare("INSERT INTO comments (username, picture, comment) VALUES (?, ?, ?)");
$stmt->bind_Param('s', $username);
$stmt->bind_Param('d', $picture);
$stmt->bind_Param('s', $comment);
$username=$_SESSION['username'];
$picture=$_GET['id'];
$comment=$_POST['comment'];
$stmt->execute();
有什么问题吗?
I'm getting this error : Number of variables doesn't match number of parameters in prepared statement
every time I run this code:
$dbh = new mysqli("localhost", "***", "***", "pics");
$stmt = $dbh->prepare("INSERT INTO comments (username, picture, comment) VALUES (?, ?, ?)");
$stmt->bind_Param('s', $username);
$stmt->bind_Param('d', $picture);
$stmt->bind_Param('s', $comment);
$username=$_SESSION['username'];
$picture=$_GET['id'];
$comment=$_POST['comment'];
$stmt->execute();
What's the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将所有参数放入一个
bindParam
调用中:Try putting all the parameters into one
bindParam
call: