summaryrefslogtreecommitdiff
path: root/all-posts.php
blob: fabeb3caaa73f5a80723c565591f89a6ad35098b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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>