koerseadmin/server/getchampionships.php
2015-09-03 22:36:35 +02:00

32 lines
658 B
PHP

<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
//fetch the championships
$champfetch = pg_prepare($dbconn, "champfetch", "select * from championship");
$champfetch = pg_execute($dbconn, "champfetch", array());
//build result object
$championships = array();
while($row = pg_fetch_assoc($champfetch)) {
$championships[] = $row;
}
$result['championships'] = $championships;
//return data
$result['ok'] = true;
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>