<?php
	
	$query = "SELECT aqcm_SITE_ID FROM AQCM05_SONDES_MESURES WHERE (aqcm_MAC='" . $mac . "')";
	//echo $query . "</br>";

	$result = mysqli_query($link, $query); 
	
	if (!$result) {	
		$sonde_exists_erreur = 2;
	}
	else {
		if (mysqli_num_rows($result) != 1) {	
			$sonde_exists_erreur = 3;
		}
		else {
			
			$row = mysqli_fetch_array($result, MYSQLI_BOTH);

			$found_SITE_ID    = $row["aqcm_SITE_ID"];
			
			if ( $found_SITE_ID != $sent_SITE_ID ) {
				$sonde_exists_erreur = 4;
			} 
			else {
				$sonde_exists_erreur = 0;
			}
			
		}
	}

?>
