Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/Liste/liste_promotion.php
<?
	if ($user_type==3) $result = mysql_query("SELECT distinct(promotion.id_promotion),diplome.libelle as L1,promotion.libelle as L2 FROM promotion,diplome,gerer WHERE gerer.id_gestionnaire=$user_id AND promotion.id_promotion=gerer.id_promotion AND diplome.id_diplome=promotion.id_diplome ORDER BY diplome.libelle");
	else $result = mysql_query("SELECT id_promotion,diplome.libelle as L1,promotion.libelle as L2 FROM promotion,diplome WHERE promotion.id_diplome=diplome.id_diplome ORDER BY diplome.libelle");
	$index_max = mysql_num_rows($result); 
	if ($user_type==3 && $index_max == 1)
	{
		$a_record = mysql_fetch_array($result);
		print("          <input type=\"hidden\" name=\"id_promotion[0]\" value=".$a_record["id_promotion"].">\n");
		$id_promotion[0]=$a_record["id_promotion"];
  		print($a_record["L1"]." ".$a_record["L2"]);
  		print("\n");
	}
	else
	{
		print("          <select tabindex=-1 multiple name=\"id_promotion[]\" size=5 width=200 OnChange=\"choice.value=-1; submit();\">\n");
		for ($i=0;$i<$index_max;$i++)
		{
			$a_record = mysql_fetch_array($result);
			$found = false;
	  		$j = 0;
	  		while (!$found && $j<$n)
	  		{
       			if ($id_promotion[$j] == $a_record["id_promotion"]) $found = true;
    	    		else $j++;
	  		}
	  		if ($found) print("          <option selected value=".$a_record["id_promotion"].">");
	  		else print("          <option value=".$a_record["id_promotion"].">");
	  		print($a_record["L1"]." ".$a_record["L2"]);
	  		print("</option>\n");
		}
		print("          </select>\n");
	}
?>
Return current item: EmploiNet : a timetable web manager