<?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);

	$driverdelete = pg_prepare($dbconn, "driverdelete", "delete from driver where iddriver = $1");
	$driverdelete = pg_execute($dbconn, "driverdelete", array($post['iddriver']));

	if($driverdelete===FALSE) {
		$result['ok'] = false;
		$result['error'] = pg_last_error($dbconn);
	} else {
		//return data
		$result['ok'] = true;
		$result['debug'] = 'deleted iddriver '.$post['iddriver'];
	}

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

	echo $resultjson;
?>
