2020-03-08 15:03:30 +01:00
|
|
|
<?php
|
|
|
|
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
|
|
|
|
$error = false;
|
|
|
|
$error_message = "";
|
|
|
|
if (!$error) {
|
2020-03-08 15:29:36 +01:00
|
|
|
$statement = $pdo->prepare("SELECT * FROM posts WHERE board_id=:bid ORDER BY post_time asc");
|
|
|
|
$statement->execute(array("bid"=>$id));
|
2020-03-08 15:03:30 +01:00
|
|
|
foreach($statement->fetchAll() as $ROW) {
|
2020-03-08 15:29:36 +01:00
|
|
|
$error = false;
|
|
|
|
$error_message = "";
|
|
|
|
if (!$error) {
|
|
|
|
$statement = $pdo->prepare("SELECT * FROM users WHERE id=:uid");
|
|
|
|
$statement->execute(array("uid"=>$ROW[user_id]));
|
|
|
|
$user = $statement->fetch();
|
|
|
|
}
|
|
|
|
if (!$result) {
|
|
|
|
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
|
|
|
}
|
2020-03-08 15:23:34 +01:00
|
|
|
echo "<section>";
|
2020-03-08 15:55:19 +01:00
|
|
|
echo "<h1>$ROW[title]</h1>";
|
2020-03-08 15:23:34 +01:00
|
|
|
echo "<article>";
|
|
|
|
echo "<header>";
|
|
|
|
echo "<div>";
|
2020-03-08 15:31:29 +01:00
|
|
|
echo "<p class='beige'>$user[name] <time datetime='$ROW[post_time]'>$ROW[post_time]</time></p>";
|
2020-03-08 15:23:34 +01:00
|
|
|
echo "</div>";
|
|
|
|
echo "</header>";
|
|
|
|
echo "<div class='postcontent'>";
|
|
|
|
echo "<p>$ROW[content]</p>";
|
|
|
|
echo "</div>";
|
|
|
|
echo "</article>";
|
|
|
|
echo "</section>";
|
2020-03-08 15:03:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!$result) {
|
|
|
|
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|