diff options
Diffstat (limited to 'all-posts.php')
-rw-r--r-- | all-posts.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/all-posts.php b/all-posts.php new file mode 100644 index 0000000..fabeb3c --- /dev/null +++ b/all-posts.php @@ -0,0 +1,28 @@ +<?php session_start()?> +<!DOCTYPE html> +<html> +<head> + <title>All posts - cflip.net forum</title> +</head> +<body style="width: 720px;margin: auto;"> + <?php include_once 'templates/header.php'; ?> + <h2>All Posts</h2> + <?php + include_once 'includes/db_inc.php'; + include_once 'includes/functions_display.php'; + + $sql = "SELECT post_id, post_content, post_date, post_author, user_id, user_name FROM posts LEFT JOIN users ON post_author = user_id";; + $result = mysqli_query($dbc, $sql); + + if (!$result) { + die('Error trying to display posts: ' . mysqli_error($dbc)); + } + + if (mysqli_num_rows($result) == 0) { + echo 'This forum has no posts'; + } else { + display_posts($dbc, 1, $result); + } + ?> +</body> +</html>
\ No newline at end of file |