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

时间:2016-03-29 17:21:08

标签: php pdo

我看到了这个错误。你能帮我吗?感谢

警告:PDOStatement :: execute():SQLSTATE [HY093]:参数号无效:绑定变量数与第13行C:\ xampp \ htdocs \ add.php中的标记数不匹配

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 个答案:

答案 0 :(得分:3)

INSERT INTO transaction SET date = ?, name = ?, cac = ?, caa = ?, cc = ?, dac = ?, daa = ?, dc = ?
-----------------------------------------------------------------------^

?

之后错过cc =