Print table data

-1

I have this code:

$sql = mysqli_query($strcon, "SELECT * FROM cadastro");
$exibe = mysqli_fetch_row($sql);
echo "<table>"; 
echo  "<tr><td>Nome:</td>";
echo "<td>".$exibe[1]."</td></tr>";
echo  "<tr><td>Sobrenome:</td>";
echo "<td>".$exibe[2]."</td></tr>"; 

Give me the result:

Nome:   Olivaldo
Sobrenome:  Liveira
  

Note: Data passed via method POST in <form>

I want to bring all the results, from my table on the screen, Bring in all the ID lines.

Not without where to start searching. Can you help me please?

    
asked by anonymous 24.08.2018 / 18:50

1 answer

1

Enter a while to receive all records from the database.

echo "<table>"; 

$sql = mysqli_query($strcon, "SELECT * FROM cadastro");
while($exibe = mysqli_fetch_row($sql)){

   echo  "<tr><td>Nome:</td>";
   echo "<td>".$exibe[1]."</td></tr>";
   echo  "<tr><td>Sobrenome:</td>";
   echo "<td>".$exibe[2]."</td></tr>";

}

echo "</table>";
    
24.08.2018 / 18:57