3 function handle_request($id, $input) {
6 $db = new SQLite3('database.sqlite');
7 $query1 = $db->query("SELECT * FROM candidatos");
9 while ($candidate = $query1->fetchArray(SQLITE3_ASSOC
)) {
10 $id = $candidate['id'];
13 $query2 = $db->query("SELECT * FROM votos where candidato_id = {$id}");
15 while ($vote = $query2->fetchArray(SQLITE3_ASSOC
)) {
21 'name' => $candidate['nombre'],
28 echo json_encode($list);