diff --git a/dashboard.php b/dashboard.php
index 2666c0e..a15acd9 100644
--- a/dashboard.php
+++ b/dashboard.php
@@ -124,7 +124,7 @@ function number_get_formatted($num) {
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/db/migrations/17_add_equity_pct_to_investments.sql b/db/migrations/17_add_equity_pct_to_investments.sql
new file mode 100644
index 0000000..190d7d9
--- /dev/null
+++ b/db/migrations/17_add_equity_pct_to_investments.sql
@@ -0,0 +1,2 @@
+-- Migration: Add equity_pct to investments table
+ALTER TABLE investments ADD COLUMN equity_pct DECIMAL(5, 2) DEFAULT 0.00 AFTER amount;
diff --git a/discover.php b/discover.php
index d3f3e74..f1ac3c6 100644
--- a/discover.php
+++ b/discover.php
@@ -102,7 +102,7 @@ $browseStartups = $stmt->fetchAll();
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/edit_profile.php b/edit_profile.php
index 9aade23..9b0a2dd 100644
--- a/edit_profile.php
+++ b/edit_profile.php
@@ -78,7 +78,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/funding_rounds.php b/funding_rounds.php
new file mode 100644
index 0000000..9ccc26a
--- /dev/null
+++ b/funding_rounds.php
@@ -0,0 +1,146 @@
+prepare("SELECT * FROM users WHERE id = ?");
+$stmt->execute([$user_id]);
+$user = $stmt->fetch();
+if (!$user) { header('Location: login.php'); exit; }
+
+if ($user['role'] !== 'investor') {
+ header('Location: dashboard.php');
+ exit;
+}
+
+$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
+
+// Fetch ONLY active funding rounds
+$stmt = db()->prepare("
+ SELECT s.*, fr.id as round_id, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status, u.full_name as founder_name
+ FROM funding_rounds fr
+ JOIN startups s ON fr.startup_id = s.id
+ LEFT JOIN users u ON s.founder_id = u.id
+ WHERE fr.status = 'Active'
+ ORDER BY fr.created_at DESC
+");
+$stmt->execute();
+$activeRounds = $stmt->fetchAll();
+
+?>
+
+
+
+
+
+ Active Funding Rounds — = htmlspecialchars($platformName) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Active Funding Rounds
+
Direct access to the most promising student startups seeking capital right now.
+
+
+
+
+
+
+
No active rounds at the moment
+
Check back soon for new opportunities or browse all startups.
+
Browse Startups
+
+
+
+
+
+
+
= htmlspecialchars($round['industry']) ?>
+
= htmlspecialchars($round['name']) ?>
+
by = htmlspecialchars($round['founder_name']) ?>
+
+
+
Goal
+
£= number_format($goal) ?>
+
+
+
+
+ £= number_format($raised) ?> Secured
+ = $progress ?>%
+
+
+
+
+
+
Platform Yield
+
= number_format($round['recommended_return_rate'] ?? 5.0, 1) ?>%
+
+
+
Founder Yield
+
= $round['founder_return_rate'] ? number_format($round['founder_return_rate'], 1) . '%' : 'N/A' ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/invest.php b/invest.php
new file mode 100644
index 0000000..092aacc
--- /dev/null
+++ b/invest.php
@@ -0,0 +1,136 @@
+prepare("
+ SELECT s.*, fr.id as round_id, fr.funding_goal, fr.funding_raised, fr.status as round_status
+ FROM startups s
+ LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active'
+ WHERE s.id = ?
+");
+$stmt->execute([$startupId]);
+$startup = $stmt->fetch();
+
+if (!$startup) {
+ die("Startup not found.");
+}
+
+if ($startup['round_status'] !== 'Active') {
+ die("This startup does not have an active funding round.");
+}
+
+$error = '';
+$success = '';
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $amount = (float)($_POST['amount'] ?? 0);
+ $investor_id = $_SESSION['user_id'];
+
+ if ($amount <= 0) {
+ $error = "Please enter a valid investment amount.";
+ } else {
+ db()->beginTransaction();
+ try {
+ // 1. Create investment record
+ // Note: We'll assume 1% equity for every £1000 for simplicity or use a formula
+ // Actually let's look at the database schema for investments
+ $equity_pct = round(($amount / $startup['funding_goal']) * 10, 2); // Mock logic for equity
+
+ $stmt = db()->prepare("INSERT INTO investments (startup_id, investor_id, funding_round_id, amount, equity_pct, status) VALUES (?, ?, ?, ?, ?, 'pending')");
+ $stmt->execute([$startupId, $investor_id, $startup['round_id'], $amount, $equity_pct]);
+
+ // 2. Update funding_rounds raised amount
+ $stmt = db()->prepare("UPDATE funding_rounds SET funding_raised = funding_raised + ? WHERE id = ?");
+ $stmt->execute([$amount, $startup['round_id']]);
+
+ // 3. Update startup total raised
+ $stmt = db()->prepare("UPDATE startups SET funding_raised = funding_raised + ? WHERE id = ?");
+ $stmt->execute([$amount, $startupId]);
+
+ db()->commit();
+ $success = "Investment of £" . number_format($amount) . " submitted successfully! The founder will be notified.";
+ header("refresh:3;url=portfolio.php");
+ } catch (Exception $e) {
+ db()->rollBack();
+ $error = "Error: " . $e->getMessage();
+ }
+ }
+}
+
+$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
+?>
+
+
+
+
+ Invest in = htmlspecialchars($startup['name']) ?> | = htmlspecialchars($platformName) ?>
+
+
+
+
+
+
+
+
Back = htmlspecialchars($startup['name']) ?>
+
+ You are participating in the active funding round for this startup.
+
+
+
+
+ = htmlspecialchars($error) ?>
+
+
+
+
+
+ = htmlspecialchars($success) ?>
+
+
+
+
+ Funding Goal
+ £= number_format($startup['funding_goal']) ?>
+
+
+ Already Raised
+ £= number_format($startup['funding_raised']) ?>
+
+
+
+ Remaining
+ £= number_format(max(0, $remaining)) ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/messages.php b/messages.php
index 5e2eb98..567aa6e 100644
--- a/messages.php
+++ b/messages.php
@@ -138,7 +138,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content']) && $active
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/notifications.php b/notifications.php
index 1ef08cf..d818e26 100644
--- a/notifications.php
+++ b/notifications.php
@@ -46,7 +46,7 @@ $notifications = $stmt->fetchAll();
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/partners.php b/partners.php
index 9146f15..3a2b948 100644
--- a/partners.php
+++ b/partners.php
@@ -123,7 +123,7 @@ if (!$search) { usort($browseCandidates, function($a, $b) { return $b['score'] <
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/portfolio.php b/portfolio.php
index bfc2942..8615ae8 100644
--- a/portfolio.php
+++ b/portfolio.php
@@ -56,7 +56,7 @@ foreach ($myInvestments as $inv) {
My Startups
Find Partners
- Browse Startups
+ Browse StartupsFunding Rounds
Portfolio
Discovery Hub
diff --git a/startup_details.php b/startup_details.php
index 961a7a7..f412495 100644
--- a/startup_details.php
+++ b/startup_details.php
@@ -7,6 +7,11 @@ if (!isset($_SESSION['user_id'])) {
exit;
}
+$user_id = $_SESSION['user_id'];
+$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
+$stmt->execute([$user_id]);
+$user = $stmt->fetch();
+
$startupId = $_GET['id'] ?? null;
if (!$startupId) {
header('Location: startups.php');
@@ -23,7 +28,7 @@ if (!$startup) {
// Check if user is the founder or an investor
$isFounder = ($_SESSION['user_id'] == $startup['founder_id']);
-$isInvestor = ($_SESSION['user_role'] == 'investor');
+$isInvestor = ($user['role'] == 'investor');
// Basic permissions check
if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) {
@@ -34,23 +39,27 @@ if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) {
$canSeeHistory = $isFounder || $isInvestor;
$fundingHistory = [];
if ($canSeeHistory) {
- $stmt = db()->prepare("SELECT i.*, u.name as investor_name FROM investments i JOIN users u ON i.investor_id = u.id WHERE i.startup_id = ? ORDER BY i.created_at DESC");
+ $stmt = db()->prepare("SELECT i.*, u.full_name as investor_name FROM investments i JOIN users u ON i.investor_id = u.id WHERE i.startup_id = ? ORDER BY i.created_at DESC");
$stmt->execute([$startupId]);
$fundingHistory = $stmt->fetchAll();
}
// Fetch founders
-$stmt = db()->prepare("SELECT name FROM users WHERE id = ?");
+$stmt = db()->prepare("SELECT full_name as name FROM users WHERE id = ?");
$stmt->execute([$startup['founder_id']]);
$founder = $stmt->fetch();
+$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
?>
= htmlspecialchars($startup['name']) ?> | Startup Details
-
+
+
+
+