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