drwurqczo39355510 2016-03-29 17:21
浏览 157
已采纳

PDOStatement :: execute():SQLSTATE [HY093]错误[关闭]

I see this error. Would you help me? Thanks

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:\xampp\htdocs\add.php on line 13

add.php

<?php
require_once 'connect.php';
if (isset($_POST['date'], $_POST['name'])) {
    $date = $_POST['date'];
    $name = $_POST['name'];
    $cac = $_POST['cac'];
    $caa = $_POST['caa'];
    $cc = $_POST['cc'];
    $dac = $_POST['dac'];
    $daa = $_POST['daa'];
    $dc = $_POST['dc'];
    $query = $db->prepare("INSERT INTO transaction SET date = ?, name = ?, cac = ?, caa = ?, cc =, dac = ?, daa = ?, dc = ?"); 
    $insert = $query->execute(array( $date, $name, $cac, $caa, $cc, $dac, $daa, $dc));
    header("refresh:11;url=index.php");
}
else {echo "We have a problem";
    header("refresh:1;url=index.php");
    }
?>
  • 写回答

1条回答 默认 最新

  • doumu2172 2016-03-29 17:22
    关注
    INSERT INTO transaction SET date = ?, name = ?, cac = ?, caa = ?, cc = ?, dac = ?, daa = ?, dc = ?
    -----------------------------------------------------------------------^
    

    miss a ? after cc =

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化