„threadr/boards/index.php“ ändern

master
Jakob 2020-02-19 22:23:41 +01:00
parent 1f04842feb
commit 368d93b997
1 changed files with 6 additions and 8 deletions

View File

@ -6,11 +6,10 @@
</head> </head>
<body> <body>
<?php <?php
try {
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!'); $pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$error = false; $error = false;
$error_message = ""; $error_message = "";
if (!$error) {
$statement = $pdo->prepare("SELECT name FROM boards"); $statement = $pdo->prepare("SELECT name FROM boards");
$statement->execute(); $statement->execute();
@ -21,11 +20,10 @@
} }
echo "</ul>" echo "</ul>"
} }
catch(PDOException $Exception) {
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2]; $error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
} }
$pdo = null;
?> ?>
</body> </body>
</html> </html>