-1
I have the qtd_stock column in the cadastral table. In a div, I want to display the values of all lines summed.
I tried this way, which does not show any value:
<?php
$sql2 = mysqli_query($conexao, "SELECT sum(qtd_estoque) FROM cadastraproduto");
$linhas = mysqli_num_rows($sql2);
while($linhas = mysqli_fetch_array($sql2)){
$linhas['sum(qtd_estoque)'];
?>
<?php
}
?>
Displaying:
<div class="col-md-3 view-produto-estoque">
<p class="p-dashboard"> Estoque </p>
<h2 class="p-toal-produtos"><?php echo $linhas; ?></h2>
</div>
I just saw that if I put echo next to while, the value is displayed. I think my mistake is in pulling that value in the <H2>
– Gabriel Melo