You solve it in several ways but I'll show it to you with a WHILE loop
As I show you in my example the HTML tags have been added and
already with css you can apply the style you want
Since you do not show the structure, that is, the columns of your table, you can add an example
<!DOCTYPE html>
<html>
<head> <title>CRITICO</title>
</head>
<body>
<?php
$con=mysqli_connect('127.0.0.1','root','password','blog') or die ('Error en la conexion');
$sql="SELECT * FROM posts";
$resultado=mysqli_query($con,$sql) or die ('Error en el query database');
while($fila = $resultado->fetch_assoc())
{
echo ("<p>".$fila["title"]."</p>");
echo ("<p>".$fila["body"]."</p>");
}
?>
</body>
</html>
As you can see I do a while, since as a loop it helps me to navigate the entire dataset I am receiving from the server query.
The variable $fila
is the one that stores the result of this query, therefore inside brackets I will pass the name of the key or column of my table to which I want to access.
I use fetch_assoc to be able to treat the dataset I am receiving as an associative array
Now at the end to add HTML tags, I just put them between
quotes and concatenated or pasted my variable row at the beginning and at the
final; in this case I used a p-label and with the sign of. he
concatena
UPDATE
If you want to show it in a table just take a look at the example that I leave below; the styles I leave to you so that you put them
<!DOCTYPE html>
<html>
<head> <title>CRITICO</title>
</head>
<body>
<table>
<tr>
<th>title</th>
<th>body</th>
</tr>
<tr>
<?php
$con=mysqli_connect('127.0.0.1','root','password','blog') or die ('Error en la conexion');
$sql="SELECT * FROM posts";
$resultado=mysqli_query($con,$sql) or die ('Error en el query database');
while($fila = $resultado->fetch_assoc())
{
echo ("<td>".$fila["title"]."</td>");
echo ("<td>".$fila["body"]."</td>");
}
?>
</tr>
</table>
</body>
</html>