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

0

I've had this error for a few days, I've seen similar answers here on the site and also in the English community, but I do not find the right answer to my situation.

  

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

By my research this error is referring to the table name being wrong or the fields, and I 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>
                ";

    
asked by anonymous 04.06.2018 / 15:41

1 answer

2

The correct one is:

bind_param()
  

mysqli bind_param reference

    
04.06.2018 / 15:50