prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); if (!$user) { header('Location: login.php'); exit; } $startup_id = (int)($_GET['id'] ?? 0); $stmt = db()->prepare("SELECT * FROM startups WHERE id = ?"); $stmt->execute([$startup_id]); $startup = $stmt->fetch(); if (!$startup) { header('Location: startups.php'); exit; } $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $error = ''; $success = ''; // Check if user is following $stmt = db()->prepare("SELECT id FROM startup_followers WHERE user_id = ? AND startup_id = ?"); $stmt->execute([$user_id, $startup_id]); $isFollowing = $stmt->fetch(); // Actions: follow/unfollow, invest, post_update if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) { if ($_POST['action'] === 'follow') { $stmt = db()->prepare("INSERT IGNORE INTO startup_followers (user_id, startup_id) VALUES (?, ?)"); $stmt->execute([$user_id, $startup_id]); $success = "You are now following " . $startup['name'] . "!"; } elseif ($_POST['action'] === 'unfollow') { $stmt = db()->prepare("DELETE FROM startup_followers WHERE user_id = ? AND startup_id = ?"); $stmt->execute([$user_id, $startup_id]); $success = "You have unfollowed " . $startup['name'] . "."; } elseif ($_POST['action'] === 'invest' && $user['role'] === 'investor') { $amount = (float)($_POST['amount'] ?? 0); if ($amount > 0) { $stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? AND status = 'Active'"); $stmt->execute([$startup_id]); $round = $stmt->fetch(); if ($round) { $stmt = db()->prepare("INSERT INTO investments (investor_id, startup_id, amount, status) VALUES (?, ?, ?, 'approved')"); $stmt->execute([$user_id, $startup_id, $amount]); $stmt = db()->prepare("UPDATE funding_rounds SET funding_raised = funding_raised + ? WHERE id = ?"); $stmt->execute([$amount, $round['id']]); $stmt = db()->prepare("UPDATE startups SET funding_raised = funding_raised + ? WHERE id = ?"); $stmt->execute([$amount, $startup_id]); // Create notification for founder $notif = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)"); $notif->execute([$startup['founder_id'], $user['full_name'] . " just invested £" . number_format($amount) . " in " . $startup['name'] . "!"]); $success = "Investment of £" . number_format($amount) . " successfully processed!"; // Refresh data $stmt = db()->prepare("SELECT * FROM startups WHERE id = ?"); $stmt->execute([$startup_id]); $startup = $stmt->fetch(); } } } elseif ($_POST['action'] === 'post_update' && $user['role'] === 'founder' && $startup['founder_id'] == $user_id) { $title = $_POST['update_title'] ?? ''; $content = $_POST['update_content'] ?? ''; if ($title && $content) { $stmt = db()->prepare("INSERT INTO startup_updates (startup_id, title, content) VALUES (?, ?, ?)"); $stmt->execute([$startup_id, $title, $content]); // Notify followers $stmt = db()->prepare("SELECT user_id FROM startup_followers WHERE startup_id = ?"); $stmt->execute([$startup_id]); $followers = $stmt->fetchAll(PDO::FETCH_COLUMN); if (!empty($followers)) { $notif = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)"); foreach ($followers as $f_id) { $notif->execute([$f_id, "New update from " . $startup['name'] . ": " . $title]); } } $success = "Update posted successfully!"; } } } $stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? AND status = 'Active'"); $stmt->execute([$startup_id]); $activeRound = $stmt->fetch(); // Permission check for Funding History: Founders see their own, Investors see all. $canSeeHistory = ($user['role'] === 'investor' || ($user['role'] === 'founder' && $startup['founder_id'] == $user_id)); // Fetch Funding History $fundingHistory = []; if ($canSeeHistory) { $stmt = db()->prepare(" SELECT i.*, u.full_name as investor_name, u.profile_photo as investor_photo FROM investments i JOIN users u ON i.investor_id = u.id WHERE i.startup_id = ? AND i.status = 'approved' ORDER BY i.created_at DESC "); $stmt->execute([$startup_id]); $fundingHistory = $stmt->fetchAll(); } ?> <?= htmlspecialchars($startup['name']) ?> — <?= htmlspecialchars($platformName) ?>
<?= htmlspecialchars($platformName) ?> Logo
Log Out

Founded

About the Venture

Funding History

No investment history available yet.

£
Investment

Public Updates

prepare("SELECT * FROM startup_updates WHERE startup_id = ? ORDER BY created_at DESC"); $stmt->execute([$startup_id]); $updates = $stmt->fetchAll(); ?>

No updates have been posted yet.

Posted on

Venture Financials

£
Total Raised All-Time
Investors
Followers
Seed
Stage

Active Round

0) ? min(100, ($activeRound['funding_raised'] / $activeRound['funding_goal']) * 100) : 0; ?>
£ £ target
This is your active funding round. Share the link with potential investors to reach your goal.

Founder

prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$startup['founder_id']]); $founder = $stmt->fetch(); ?>
Send Message