diff --git a/dashboard.php b/dashboard.php index debbacc..53a0e44 100644 --- a/dashboard.php +++ b/dashboard.php @@ -68,7 +68,7 @@ if ($user['role'] === 'founder') { SELECT s.*, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status, fr.id as round_id FROM startups s LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active' - WHERE s.user_id = ? + WHERE s.founder_id = ? ORDER BY s.created_at DESC "); $stmt->execute([$_SESSION['user_id']]); diff --git a/invest.php b/invest.php index 3f15168..2168d9f 100644 --- a/invest.php +++ b/invest.php @@ -14,7 +14,7 @@ if (!$startupId) { } $stmt = db()->prepare(" - SELECT s.*, fr.id as round_id, fr.funding_goal, fr.funding_raised, fr.status as round_status, s.user_id as founder_id + SELECT s.*, fr.id as round_id, fr.funding_goal, fr.funding_raised, fr.status as round_status, s.founder_id as founder_id FROM startups s LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active' WHERE s.id = ? diff --git a/startup_details.php b/startup_details.php index 8049270..24c87a9 100644 --- a/startup_details.php +++ b/startup_details.php @@ -32,7 +32,7 @@ if (!$startup) { } // Check if user is the founder or an investor -$isFounder = ($_SESSION['user_id'] == $startup['user_id']); +$isFounder = ($_SESSION['user_id'] == $startup['founder_id']); $isInvestor = ($user['role'] == 'investor'); // Basic permissions check @@ -69,8 +69,8 @@ if ($isFounder) { } // Fetch founders -$stmt = db()->prepare("SELECT id, full_name as name FROM users WHERE id = ?"); -$stmt->execute([$startup['user_id']]); +$stmt = db()->prepare("SELECT id, full_name FROM users WHERE id = ?"); +$stmt->execute([$startup['founder_id']]); $founder = $stmt->fetch(); $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; @@ -318,13 +318,13 @@ function getNextDividendInfo($createdAt) { = htmlspecialchars($startup['name']) ?>
- Founded by = htmlspecialchars($founder['name']) ?> + Founded by = htmlspecialchars($founder['full_name']) ?>