prepare("INSERT INTO comments (user_id, comment) VALUES (:user_id, :comment)"); $stmt->execute(['user_id' => $_SESSION['user_id'], 'comment' => $comment_text]); } catch (PDOException $e) { // Optional: handle error, e.g., log it or show a generic error message } } // Redirect to the same page to prevent form resubmission header("Location: index.php"); exit; } // Fetch comments $comments = []; if (isset($_SESSION['user_id'])) { try { $stmt = db()->query(" SELECT c.comment, c.created_at, u.username FROM comments c JOIN users u ON c.user_id = u.id ORDER BY c.created_at DESC "); $comments = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { // Optional: handle error } } ?>
Upload a photo, pick a style, and see the magic.
Join us and start transforming your pictures with unique artistic styles.
Get Started Now
Community Feedback
No comments yet. Be the first to share your thoughts!