prepare('SELECT display_name, description, occupation FROM users WHERE id = ?'); $stmt->execute([$user_id]); $user = $stmt->fetch(); if (!$user) { header('Location: index.php'); exit(); } $stmt = $p->prepare('SELECT p.id, p.content, p.created_at, u.display_name, (SELECT COUNT(*) FROM post_votes WHERE post_id = p.id AND vote = 1) as likes, (SELECT COUNT(*) FROM post_votes WHERE post_id = p.id AND vote = -1) as dislikes FROM posts p JOIN users u ON p.user_id = u.id WHERE p.user_id = ? ORDER BY p.created_at DESC'); $stmt->execute([$user_id]); $posts = $stmt->fetchAll(); ?> <?= htmlspecialchars($user['display_name']) ?>'s Profile

Posts by

This user has no posts yet.

Posted on

Back to Feed