prepare("INSERT INTO collaborations (user_id, title, description) VALUES (?, ?, ?)"); $stmt->execute([$_SESSION['user_id'], $title, $description]); $successMessage = "Your collaboration post has been created!"; } catch (PDOException $e) { $errors[] = "Database error: " . $e->getMessage(); } } } // Fetch all open collaboration posts $collaborations = []; try { $stmt = $pdo->query("SELECT c.id, c.title, c.description, c.created_at, u.username FROM collaborations c JOIN users u ON c.user_id = u.id WHERE c.status = 'open' ORDER BY c.created_at DESC"); $collaborations = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { $errors[] = "Error fetching collaboration posts: " . $e->getMessage(); } ?>
No open collaborations at the moment. Why not start one?