PDO select in tabelle ausgeben
bearbeitet von smokey-joeHab es hinbekommen ;) try and error hat funktioniert XD
~~~php
<html>
<body>
<p>Bitte tragen sie die erforderlichen Daten ein</p>
<form action = "eingabe.php" method = "post">
<p><input name = "name" /> Name</p>
<p><input name = "geschlecht" /> Geschlecht</p>
<p><input name = "gattung" /> Gattung</p>
<p><input type = "submit" />
<input type = "reset" /></p>
</form>
<?php
$pdo = new PDO('mysql:host=localhost;dbname=aquarium', 'mein_DB_Username', 'mein_DB_PW');
$sql = "SELECT id, name, gattung, geschlecht FROM aqua";
?>
<table>
<tbody>
<?php foreach ($pdo->query($sql) as $row) : ?>
<tr>
<td><?=$row['id']?></td>
<td><?=$row['name']?></td>
<td><?=$row['gattung']?></td>
<td><?=$row['geschlecht']?></td>
</tr>
<?php endforeach; ?>
</tbody>
<table>
</body>
</html>
~~~
Danke ;)