未捕获pdoexception:sqlstate[hy093]:无效参数编号:绑定变量的数量与令牌的数量不匹配

e5nszbig  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(321)

我得到这个错误:
sqlstate[hy093]:无效参数编号:绑定变量的数量与令牌的数量不匹配。
我正在尝试查看以下数据是否已经存在

<php? 
Class Painel{ 
    public static function operacaoExists($ncliente,$cliente,$valor,$datavenc,$status,$dataope,$ncontrato,$ndocumento){
        $sql = MySql::conectar()->prepare("SELECT `id` 
                        FROM `tb_vencimentos` 
                        WHERE n_cliente = ?, 
                        NomedeFantasia = ?, 
                        valor LIKE '%?%', 
                        data_do_venc = ?, 
                        status = ?, 
                        data_da_ope = ?, 
                        ncontrato = ?, 
                        n_documento = ? ");
        $sql->execute(array($ncliente,$cliente,$valor,
                            $datavenc,$status,$dataope,
                            $ncontrato,$ndocumento));

        if($sql->rowCount() == 1){
            return true;

        }else{
            return false;
        }
    }
}
?>

<?php

        if(isset($_POST['acao'])){
            $ncliente = $_POST['ncliente'];
            $cliente = $_POST['nfantasia'];
            $valor = $_POST['valor'];
            $datavenc = date('Y-m-d',strtotime($_POST['datavenc']));
            $status = $_POST['status'];
            $dataope = date('Y-m-d',strtotime($_POST['dataope']));
            $ncontrato = $_POST['ncontrato'];
            $ndocumento = $_POST['ndocumento'];
            $doc = $_FILES['doc'];

            if(Painel::operacaoExists($ncliente,$cliente,$valor,$datavenc,$status,$dataope,$ncontrato,$ndocumento)){
                    Painel::alert('erro','select other contract');
            }else{
                if($doc['name'] == ''){
                    $doc = '0';
                    $operacao = new Painel();
                    $operacao->cadastrarOperacao($ncliente,$cliente,$valor,$datavenc,$status,$dataope,$ncontrato,$ndocumento,$doc['name']);
                    Painel::alert('sucesso','succes');

                }
    ?>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题