Select Git revision
tiere-01.php
Forked from
Peter Gerwinski / Datenbanken und Datensicherheit
81 commits behind the upstream repository.
Peter Gerwinski authored
tiere-01.php 1.09 KiB
<html>
<body>
<?php
$db = new PDO ('pgsql: host = localhost; dbname = testdb; user = dbs; password = abcd');
$stmt = $db->query ('SELECT * FROM tier;');
echo '<table><tr>';
while ($row = $stmt->fetch())
{
echo '<tr><td>';
echo $row['name'];
echo '</td><td>';
echo $row['tierart'];
echo '</tr></tr>';
}
echo '</tr></table>';
?>
</body>
</html>
<!-- Aus den Log-Dateien des Web-Servers:
[Thu Dec 07 12:27:14.834918 2023] [php:error] [pid 130668] [client ::1:60980]
PHP Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] connection to
server at "localhost" (::1), port 5432 failed: FATAL:
Passwort-Authentifizierung f\xc3\xbcr Benutzer \xc2\xbbdbs\xc2\xab
fehlgeschlagen\nconnection to server at "localhost" (::1), port 5432 failed:
FATAL: Passwort-Authentifizierung f\xc3\xbcr Benutzer \xc2\xbbdbs\xc2\xab
fehlgeschlagen in /var/www/dbs/tiere-01.php:4\nStack trace:\n#0
/var/www/dbs/tiere-01.php(4): PDO->__construct()\n#1 {main}\n thrown in
/var/www/dbs/tiere-01.php on line 4
-->