Mysql
 SQL >> Datenbank >  >> RDS >> Mysql

SQL-Daten in PHP/HTML-Tabelle anzeigen

Eine einfache mysqli-Ausgabe als HTML-Tabelle:

$result = mysqli_query($conn, 'SELECT * FROM employee');
echo '<table>';
while ($row = mysqli_fetch_array($result)) {
  echo '<tr>';
  echo '<td>' . htmlspecialchars($row['name']) . '</td>';
  echo '<td>' . htmlspecialchars($row['age']) . '</td>';
  echo '</tr>';
}
echo '</table>';

mysql_fetch_array() wurde in PHP 7 entfernt. Nutzen Sie mysqli_fetch_array() oder PDO.