repo.or.cz
/
asis23-votoe-server.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Make `preflight` request pass okay
[asis23-votoe-server.git]
/
get_candidates.php
blob
c03e057f6ee1416b4d733f2d2f77644a57906a0a
1
<
?php
2
3
function
handle_request
(
$id
,
$input
) {
4
$list
= [];
5
6
$db
=
new
SQLite3
(
'database.sqlite'
);
7
$result
=
$db
->
query
(
"SELECT * FROM candidatos"
);
8
9
while
(
$row
=
$result
->
fetchArray
(
SQLITE3_ASSOC
)) {
10
$list
[] = [
11
'id'
=>
$row
[
'id'
],
12
'name'
=>
$row
[
'nombre'
],
13
];
14
}
15
16
$db
->
close
();
17
18
echo
json_encode
(
$list
);
19
}