35 lines
766 B
PHP
35 lines
766 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);
|
|
|
|
$idchampionship = $post['idchampionship'];
|
|
$idteam = $post['idteam'];
|
|
|
|
//fetch the drivers
|
|
$driverfetch = pg_prepare($dbconn, "driverfetch", "select * from driver where idchampionship = $1 and idteam = $2");
|
|
$driverfetch = pg_execute($dbconn, "driverfetch", array($idchampionship, $idteam));
|
|
|
|
//build result object
|
|
$drivers = array();
|
|
while($row = pg_fetch_assoc($driverfetch)) {
|
|
$drivers[] = $row;
|
|
}
|
|
|
|
$result['drivers'] = $drivers;
|
|
|
|
//return data
|
|
$result['ok'] = true;
|
|
|
|
//print message
|
|
$resultjson = json_encode($result);
|
|
|
|
echo $resultjson;
|
|
?>
|