0
UPDATED
I need to update a table with input fields as below:
  <table style="width: 100%;">
   <thead>
    <tr>
     <th>Item</th>
     <th>Código</th>
     <th>Produto</th>
     <th>Valor</th>
    </tr>
   </thead>
   <tbody>
   <?php while($dado_produto = $result_produtos->fetch_array()){ ?>
    <tr>
     <td>1</td>
     <td><?php echo $dado_produto['cod']; ?></td>
     <td><?php echo $dado_produto['descricao']; ?></td>
     <td><input type = "text" name="valor[<?php echo $dado_produto['cod']; ?>]"/>
     <input type = "hidden" name="linha[<?php echo $dado_produto['linha']; ?>]"/>
     </td>
   </tr>
   <?php } ?> 
   </tbody>
   </table>
   </div> 
   <input type="submit"/>
   </form>
when sending to the.php value file, the error appears:
PHP Fatal error: Call to a Member Function prepare() on a non-object
the code follows below:
if($stmt->prepare("UPDATE `produto` SET (`valor`='?' WHERE `codigo`='?' AND `linha` = '?'")) {  
    $stmt->bind_param('sii', $valor, $cod, $linha);
    for($i=0;$i<count($_POST['novo_valor']);$i++){
        $valor = $POST['novo_valor'][$i];
        $cod = $_POST['cod'][$i];
        $linha = $_POST['linha'][$i];
        $stmt->execute();
    }
    $stmt->close();
}
line 35 is the
 if($stmt->prepare("UPDATE `produto` SET (`valor`='?' WHERE `codigo`='?' AND `linha` = '?'")) {
The error concerns that?
How are you starting the variable
$stmt? You are trying to access a method in a variable that is not an object.– Marcelo de Andrade