未捕获错误:在< ........>中调用boolean上的成员函数execute()堆栈跟踪:#0 {main}抛出< .....>

时间:2018-05-14 14:17:26

标签: php mysql mysqli phpmyadmin

我一直坚持这个错误一段时间了! 有人可以向我解释我做错了什么吗? 每次我收到错误: 未捕获错误:在堆栈跟踪中调用boolean上的成员函数execute():#0 {main}抛出 它所在的行是: $ insert-> execute(array());

if (isset($_POST['submit'])) {
    $personeel = $_POST["personeel"];
    $voucher = $_POST["voucher"];

    $queryVoucher = "SELECT personeel.Voucher FROM personeel WHERE 
    personeel.personeelsnummer = $personeel";
    $voucherConn = mysqli_query($conn, $queryVoucher);

    $insert = $conn->prepare($queryVoucher);
    try{
        $insert->execute(array());
        $insert->setFetchMode(PDO::FETCH_ASSOC);
        foreach ($insert as $inser) {
            if ($inser["voucher"] == $voucher) {
                echo "U heeft zich aangemeld";
            }
        }
    }
    catch(PDOException $e){
        echo "Uw personeelsnummer en Voucher nummer komen niet overeen!";
    }

}

0 个答案:

没有答案