<?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 = mysql_query($sql);

	if (!$result)
		dbErreur(mysql_error());

	return $result;
}

function cleanQuery($result)
{
	mysql_free_result($result);
}

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

	$results = sendQuery($sql);

	$row = mysql_fetch_row($results);

	cleanQuery($results);

	return $row[0];
}

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

	$row = mysql_fetch_row($results);

	cleanQuery($results);

	return $row[0];
}

?>
