„threadr/boards/index.php“ ändern

master
Erik 2020-03-02 08:40:56 +01:00
parent 89aded6535
commit 1dadb99d8b
1 changed files with 15 additions and 16 deletions

View File

@ -18,27 +18,26 @@ $navbar="boards";
<div class="item-1"> <div class="item-1">
<h1><center>ThreadR Boards</center></h1> <h1><center>ThreadR Boards</center></h1>
</div> </div>
<div class="item-2 shadow"> <div class="item-2">
<ul class="list"> <div class="shadow">
<?php <ul class="list">
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!'); <?php
$error = false; $pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$error_message = ""; $error = false;
$error_message = "";
if (!$error) { if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards"); $statement = $pdo->prepare("SELECT * FROM boards");
$statement->execute(); $statement->execute();
foreach($statement->fetchAll() as $ROW) { foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/boards?=$ROW[id]'>$ROW[name]</a></li>"; echo "<li><a href='%CONTENT_DIR%/boards?=$ROW[id]'>$ROW[name]</a></li>";
} }
} }
if (!$result) {
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];
} }
?> ?>
</ul> </ul>
</div>
</div> </div>
</div> </div>
</body> </body>