01.
<?php
02.
header(
"Access-Control-Allow-Origin: *"
);
03.
header(
"Content-Type: application/json; charset=UTF-8"
);
04.
05.
include
"config.php"
;
06.
07.
$query
=
"SELECT * FROM tb_image_res "
;
08.
$result
=
$conn
->query(
$query
);
09.
10.
11.
$outp
=
""
;
12.
while
(
$rs
=
$result
->fetch_array(MYSQLI_ASSOC)) {
13.
if
(
$outp
!=
""
) {
$outp
.=
","
;}
14.
$outp
.=
'{"id":"'
.
$rs
["id
"].'"
,';
15.
$outp
.=
'"image_res":"'
.
$rs
["image_res
"]. '"
}';
16.
}
17.
$outp
=
'{"records":['
.
$outp
.
']}'
;
18.
$conn
->close();
19.
20.
echo
(
$outp
);
21.
?>