$stmt = $conn->query("SELECT * FROM stories WHERE expires_at > NOW() ORDER BY created_at DESC"); $stories = $stmt->fetchAll(); foreach ($stories as $story) { echo ""; }