<?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
	$champdelete = pg_prepare($dbconn, "champdelete", "delete from championship where idchampionship = $1");
	$champdelete = pg_execute($dbconn, "champdelete", array($post['idchampionship']));

	if($champdelete===FALSE) {
		$result['ok'] = false;
		$result['error'] = pg_last_error($dbconn);
	} else {
		//return data
		$result['ok'] = true;
	}

	//print message
	$resultjson =  json_encode($result);

	echo $resultjson;
?>
