prepare("SELECT * FROM food_listings WHERE id = ? AND status = 'listed'"); $stmt->execute([$listing_id]); $listing = $stmt->fetch(); if (!$listing) { header("Location: dashboard.php?error=listing_not_available"); exit; } // Update the listing to mark it as claimed $stmt = $pdo->prepare("UPDATE food_listings SET status = 'claimed', claimed_by_id = ? WHERE id = ?"); $success = $stmt->execute([$ngo_id, $listing_id]); if ($success) { header("Location: dashboard.php?success=claimed"); } else { header("Location: dashboard.php?error=claim_failed"); } exit;