Show mysql database data in a php/html page

Asked

Viewed 72 times

0

I have a problem showing data from a database table on the screen.

  1. I was able to show the data but I can’t jump the line, show the data sequentially, code below.

    $sql = $connection->query("Select * from  usuarios");
            if($sql)
           {
                while($exibe = $sql->fetch_assoc())
                    {
                        foreach($exibe as $key => $value)
                            {
                                echo "<td>". $value."</td>";
                            }
                    }
            }

Imagem de como fica

1 answer

1


Try the following:

$sql = $connection->query("Select * from  usuarios");
        if($sql)
       {
            while($exibe = $sql->fetch_assoc())
                {
                    echo "<tr>"
                    foreach($exibe as $key => $value)
                        {
                            echo "<td>". $value."</td>";
                        }
                     echo "</tr>"
                }
        }
  • 1

    It worked, thanks a lot.

  • @Gustavohenrique mark as answer please

Browser other questions tagged

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