Make `preflight` request pass okay
[asis23-votoe-server.git] / get_candidates.php
blobc03e057f6ee1416b4d733f2d2f77644a57906a0a
1 <?php
3 function handle_request($id, $input) {
4 $list = [];
6 $db = new SQLite3('database.sqlite');
7 $result = $db->query("SELECT * FROM candidatos");
9 while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
10 $list[] = [
11 'id' => $row['id'],
12 'name' => $row['nombre'],
16 $db->close();
18 echo json_encode($list);