29 lines
698 B
PHP
29 lines
698 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);
|
|
|
|
$teamdelete = pg_prepare($dbconn, "teamdelete", "delete from team where idteam = $1 and idchampionship = $2");
|
|
$teamdelete = pg_execute($dbconn, "teamdelete", array($post['idteam'], $post['idchampionship']));
|
|
|
|
if($teamdelete===FALSE) {
|
|
$result['ok'] = false;
|
|
$result['error'] = pg_last_error($dbconn);
|
|
} else {
|
|
//return data
|
|
$result['ok'] = true;
|
|
$result['debug'] = 'deleted team '.$post['idteam'];
|
|
}
|
|
|
|
//print message
|
|
$resultjson = json_encode($result);
|
|
|
|
echo $resultjson;
|
|
?>
|