< ? mysql_connect("sirius","anonymous","anonymous") ; mysql_select_db("webmass") ; $res = mysql_query("select count(nom) from stagesMaitrise ") ; $ligr = mysql_fetch_array($res) ; $nbstg = $ligr["count(nom)"] ; $res = mysql_query("select distinct an from stagesMaitrise order by an desc") ; $nban = 0 ; while ($ligr=mysql_fetch_array($res)) { $nban++ ; $an[$nban] = $ligr["an"] ; } ; # fin de tant que echo "
Il y a $nbstg stages répartis sur $nban années" ; $mpa = sprintf("%3.1f",$nbstg/$nban) ; echo " soit approximativement $mpa stages par an.

" ; echo "Nombre de stages par catégorie :

" ; echo "

" ; echo "" ; echo "" ; echo "" ; $nbca = 5 ; $cat[1] = "gp" ; $dcat[1] = " Gestion de production " ; $cat[2] = "info" ; $dcat[2] = " Informatique (analyse, développement...)" ; $cat[3] = "mkg" ; $dcat[3] = " Marketing " ; $cat[4] = "rh" ; $dcat[4] = " Ressources humaines " ; $cat[5] = "stat" ; $dcat[5] = " Statistiques et Analyse des données " ; $ica = 1 ; $stgdata = "" ; $labels = "" ; while ($ica<=$nbca) { $cac = $cat[$ica] ; $labels .= $cac ; if ($ica<$nbca) { $labels .= "_" ; } $res = mysql_query("select count(nom) from stagesMaitrise where categorie = \"$cac\" ") ; $ligr = mysql_fetch_array($res) ; $nba = $ligr["count(nom)"] ; $pcn = sprintf(" %3.0f",100.0*$nba/$nbstg) ; $stgdata .= $nba ; if ($ica<$nbca) { $stgdata .= "_" ; } echo "" ; echo "" ; echo "" ; $ica++; } ; # fin tant que sur ian echo "
Catégorie   StagesDescription   Pourcentage
   $cat[$ica]$nba   $dcat[$ica]$pcn %
" ; echo "

" ; echo " \"stages\" \n" ; echo "

" ; ? >