function getResults($election_id) global $pdo; $stmt = $pdo->prepare(" SELECT c.id, c.name, c.description, COUNT(v.id) AS votes FROM candidates c LEFT JOIN votes v ON v.candidate_id = c.id WHERE c.election_id = ? GROUP BY c.id ORDER BY votes DESC "); $stmt->execute([$election_id]); return $stmt->fetchAll();
The online voting system project aims to provide a secure, efficient, and transparent way of conducting elections online. The system will allow voters to cast their votes remotely, and the results will be displayed in real-time. function getResults($election_id) global $pdo