Print table data

Asked

Viewed 92 times

-1

I have in the following 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

Obs.: Data passed via method POST no <form>

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

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

  • @Nouzanadam is a report you’re putting together?

  • I want to create daily query board. So I decided to study php.

  • Welcome to the IT world, we need the orders

  • @Natanmartinsnouzanadam See my answer below, if she helped you, mark it as resolved

1 answer

1


Put 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>";
  • God right! Thank you!

  • @Natanmartinsnouzanadam accepted the question as solved then

  • I’m new around here I’m still trying to find out on the page where I do this kkkk

Browser other questions tagged

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