<?php
	include '../../autoload.php';
	$answer="<root>";
	$quaadpoint_tag_id	=	$_REQUEST['quaadpoint_tag_id'];
	
	error_log ( "$quaadpoint_tag_id : ".$quaadpoint_tag_id );			
	
	if ( $quaadpoint_tag_id >= 0 )
	{
		$conn = get_dbconnection();
		
		
		$sql = "delete from link_quaad_tag where id_tag=".$quaadpoint_tag_id;
		
		error_log ( "sql : ".$sql );			
	
		$query = pg_query ( $conn, $sql );
		if ( !$query )
		{
			$err = pg_last_error ($conn);
			
			$answer .= "<status value=\"".$err."\"></status>";
		}
		else
		{
			$sql = "delete from quaadpoint_tag_name where id_quaadpoint_tag=".$quaadpoint_tag_id;
			
			$query = pg_query ( $conn, $sql );
			if ( !$query )
			{
				$err = pg_last_error ($conn);
			
				$answer .= "<status value=\"".$err."\"></status>";
			}
			else
			{
				$sql = "delete from quaadpoint_tag where id=".$quaadpoint_tag_id;
		
				$query = pg_query ( $conn, $sql );
				if ( !$query )
				{
					$err = pg_last_error ($conn);
			
					$answer .= "<status value=\"".$err."\"></status>";
				}
				else
					$answer .= "<status value=\"ok\"></status>";
			}
		}
	}
	
	$answer.="</root>";
	header('Content-Type: text/xml');
	echo $answer;
?>