<?php 

function dbErreur($info)
{
	die("\n\n<h1><u>Erreur dans la base de donn&eacute;es</u></h1><p><b>$info</b>\n\n");
}

function sendQuery($sql)
{
	$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);

	if (!$result)
		dbErreur(mysqli_error($GLOBALS["___mysqli_ston"]));

	return $result;
}

function cleanQuery($result)
{
	((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false);
}

function lireNomUnite($num_unite)
{
	$sql = "SELECT nom FROM ref1unite WHERE num_unite = $num_unite;";

	$results = sendQuery($sql);

	$row = mysqli_fetch_row($results);

	cleanQuery($results);

	return $row[0];
}

function lireInfo($sql)
{
	$results = sendQuery($sql);

	$row = mysqli_fetch_row($results);

	cleanQuery($results);

	return $row[0];
}

?>
