Fatal error: Call to Undefined method mysqli_stmt::bindparam() PHP || MYSQL

Asked

Viewed 176 times

1

I’m with this error a few days ago, I’ve seen similar answers here on the site and also in the community in English, but I can not find the appropriate response to my situation.

Fatal error: Call to Undefined method mysqli_stmt::bindparam() in C: wamp www fanamol carrinho.php on line 164

By my search this error refers to the table name being wrong or fields, and I have already confirmed and everything is correct

Here is my code:

 if (!isset($_SESSION['itens'])){
    $_SESSION['itens']=array();      
}
           if(isset($_GET['add'])&& $_GET['add']=="carrinho") {
               $idproduto = $_GET['id'];
               if(!isset($_SESSION['itens'][$idproduto])){
                  $_SESSION['itens'][$idproduto]=1;  
               }else{
                       echo'O produto já se encontra no carrinho<br>';
               $_SESSION['itens'][$idproduto]+=1; 
               }
           }
            if (count($_SESSION['itens'])==0){
                echo'Carrinho vazio <br><a href="mol_compressao.php">Adicionar Itens</a>';
            }else{
                echo"
                 <h2>Resumo de Compras</h2>
                 <br>
 <div align='start'>
      <div class='card mx-auto w-100'>
        <div class='container-fluid''>
            <div class='row align-items-end' style='height:40px;'>
                <div class='col-md-2' style='text-align: center'><h5>REFERÊNCIA</h5></div>
                <div class='col-md-3' style='text-align: center'><h5>QUANTIDADE</h5></div>
                <div class='col-md-3' style='text-align: center'><h5>PREÇO UNITÁRIO</h5></div>
                <div class='col-md-2' style='text-align: center'><h5>PREÇO TOTAL</h5></div>
            </div>
        </div> 
          <hr>
                    
     
";
                include ("db.php");
                foreach($_SESSION['itens'] as $idproduto => $quantidade){
                $select_car= $con -> prepare("SELECT * FROM stock_comp WHERE id_mol_comp=$idproduto");
                    var_dump($select_car);
                    $select_car->bindparam(1,$idproduto);
                    $select_car->execute();    
                    $produtos= $select_car->fetchAll();  
                    echo"
                    $produtos[0]['referencia'].'<br/>';
                    ";
        echo "
            <div class='card-body'>
                <div class='row align-items-center' style='height:0px;'>
                    <div class='col-md-2' style='text-align: center'>$referencia</div>
                    <div class='col-md-3' style='text-align: center'>$quantidade<i style='font-size:36px' class='fa'>&#xf147;</i>&nbsp<input type='text' name='de2' size='2' >&nbsp<i style='font-size:36px' class='fa'>&#xf196;</i></div>
                    <div class='col-md-3' style='text-align: center'>".number_format($preco,2,",",".")." €</div>
                    <div class='col-md-2' style='text-align: center'>".number_format($precototal,2,",",".")." €</div>
                 <div class='col-md-2' style='text-align: center'><i class='fa fa-remove' style='font-size:24px'></i></div>

                </div>
            </div> 
               </div>
</div> 
        ";
    }
                
                 echo "
                 <br>
                            <div class='col-md-11' style='text-align: end'><h4>Total(s/IVA): ".number_format($precototal,2,",",".")." €</h4></div> 
                            
                            <div class='col-md-11' style='text-align: end'><h2>Total(c/IVA): ".number_format($precoiva,2,",",".")." €</h2></div> 
                            <br>
                ";
               
                }
                    echo"
<button type='button' class='btn btn-outline-info btn-lg btn-block'>Finalizar</button>
<br>
                ";

inserir a descrição da imagem aqui

  • 1

    It’s been a long time since I’ve worked with PHP, but the function wouldn’t be bind_param or instead of bindparam ?

1 answer

2


  • can go there on chat @Wees Smith?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.