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

Asked

Viewed 34 times

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>
  • DVD thanks and sorry for the lack of attention!

  • DVD one more question... which command is missing to read all rows of the database?

  • lines , example: more than one registered name. With this code only shows the last registered wanted to read all names.

  • Take a look at this link

  • Flávio, do me a favor: it seems that the site gave a bug. Uncheck my reply and mark again please.

  • I already did! Check if it worked!

  • Obg! It worked but still got registered -15 in reputation. It has nothing not :D... Rigadão!

Show 2 more comments

1 answer

3


Missing select the column endereco in the query:

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

Seria:

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

Browser other questions tagged

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