primero que nada iniciamos sesion en mysql con pdo
<?php
//Usaremos PDO para conectar PHP con MySQL
// Datos para conectar con la base de datos.
define('DB_HOST','localhost');
define('DB_USER','miusuario');
define('DB_PASS','micontraseña');
define('DB_NAME','mibasededatos');
// Ahora, establecemos la conexión.
try
{
// Ejecutamos las variables y aplicamos UTF8
$connect = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME,DB_USER, DB_PASS,
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));
}
catch (PDOException $e)
{
exit("Error: " . $e->getMessage());
}
?>
Ahora nos disponemos a mostrar los datos en una tipica tabla html
<table class="table table-bordered table-striped">
<thead class="thead-dark">
<th width="18%"> imagen</th>
<th width="22%"> producto</th>
<th width="14%">link de compra</th>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM menutoday ORDER BY menutoday.id ASC";
$query = $connect -> prepare($sql);
$query -> execute();
$results = $query -> fetchAll(PDO::FETCH_OBJ);
if($query -> rowCount() > 0) {
foreach($results as $result) {
echo "<tr>
<td><img class='thumbnail' src='images/".$result -> imagen."'></td>
<td><a href='".$result -> links."'><center><strong>".$result -> nombre."</strong></a></center></td>
<td><Ordenar</td>
</tr>";
}
}
?>
</tbody>
</table>