What error am I making when I put the third item "address" in the code

0
<?php   
        include"conectar.php";



        /// codigo para fazer leitura do banco de dados
        /// incluindo ?php echo $cpf ? entre <> na tabela onde ficará o registro



$query="select nome, cpf from associados ";
$stmt=mysqli_query($con,$query);
if($stmt) {

     $today = date("d.m.y");
} else {
     mysqli_rollback($con);
     echo "Transaction rolled back.<br />";
}


while($row=mysqli_fetch_array($stmt) )
{   
                  $cpf = $row['cpf'];
                  $nome = $row['nome'];
                    **$endereco = $row['endereco'];**

}


mysqli_close($con);          
        ?>


onde insiro o resultado da pesquisa
----------------------------------


 <tr>
                    <td> <?php echo $cpf ?> </td>
                    <td><?php echo $nome ?></td>
                    <td><?php echo $endereco ?></td></td>
</tr>
    
asked by anonymous 26.05.2018 / 04:13

1 answer

3

You have failed to select the endereco column in the query:

$query="select nome, cpf from associados ";

It would be:

$query="select nome, cpf, endereco from associados";
    
26.05.2018 / 04:17