<?php

class satisfaction
{
	function get_satisfaction($id_consult)
	{
		$q = "SELECT * FROM satisfaction WHERE id_consult = '" . $id_consult . "'";
		$r = mysql_query($q);

		if ($r)
		{
			$n = mysql_fetch_assoc($r);
			return $n;
		}
		else
			die("Erreur mécanique " . mysql_errno() . " : " . mysql_error());

		return false;
	}

	function edit_satisfaction($id_consult, $sat_secret, $sat_info, $sat_rdv, $sat_demandes, $sat_accueil, $sat_soins, $sat_objectif)
	{
		$q = "INSERT INTO satisfaction (id_consult, sat_secret, sat_info, sat_rdv, sat_demandes, sat_accueil, sat_soins, sat_objectif) VALUES ('" . $id_consult . "', '" . $sat_secret . "', '" . $sat_info . "', '" . $sat_rdv . "', '" . $sat_demandes . "', '" . $sat_accueil . "', '" . $sat_soins . "', '" . $sat_objectif . "')";
		$r = mysql_query($q);

		if ($r) 
			return true;
		else
			die("Erreur mécanique " . mysql_errno() . " : " . mysql_error());

		return false;
	}

	function del_satisfaction($id_consult)
	{
		$q = "DELETE FROM satisfaction WHERE id_consult = '" . $id_consult . "'";
		$r = mysql_query($q);

		if ($r)
		{
			$q = "OPTIMIZE TABLE satisfaction";
			$r = mysql_query($q);

			return true;
		}
		else
			die("Erreur mécanique " . mysql_errno() . " : " . mysql_error());

		return false;
	}
}

?>