Afficher les observation automatique sur la liste des prestation

Rkm12 Messages postés 1 Date d'inscription samedi 5 mars 2016 Statut Membre Dernière intervention 5 mars 2016 - Modifié par Rkm12 le 5/03/2016 à 03:52
jordane45 Messages postés 38145 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 25 avril 2024 - 5 mars 2016 à 12:35
Bonjour cher développeur,
je suis entrain de réaliser en php une application de suivi d'avancement des cours, j'aimerai faire à ce que si un enseignant a atteint le nombre d'heures prévues qu'on lui génère un message (vous avez atteint le nombre d'heure prévues) lorsqu'il veut faire la mise à jour de sa prestation cad après avoir enseigné et qu'il veut ajout les heures qu'il a enseigné.

Le deuxième problème ce que j'aimerai afficher les observation automatique sur la liste des prestations ("terminé" si le cours a atteint le nombre d'heures prévues, "n'avance pas bien" si le nombre d'heures prestées est inférieur à 10 heures" et "non terminé" dans le cas contraire)
Merci d'avance pour votre aide et votre attention que vous porterez sur ma question. (svp Je suis débutant en la matière!)

VOICI LE CODE
MISE A JOUR PRESTATION

<!doctype html>
<html>
<head>
<title>Résultat mis ajour de la prestation</title>
</head>
<body>
<?php
include("connexion1.php");
$a=$_POST['nomcours'];
$b=$_POST['matens'];
$c=$_POST['heureprestee'];
$req="UPDATE prestation SET heureprestee=(heureprestee+$c) WHERE nomcours='$a'and matens='$b'";
mysql_query($req) or die('Modification impossible');
echo"Mise a jour $a a reussi";
echo"<CENTER><a href=modprestation.php>Mettre a jour une autre prestation</CENTER>";
mysql_close();
?>
</body>
</html>

ENREGISTREMENT DE LA PRESTATION
<?php
include('calendrier.html');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>www.gestion_des_salles.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="mm_restaurant1.css" type="text/css" />
</head>
<body bgcolor="#0066cc">
<form method="POST" action="ajouterprestation.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#99ccff">
<td width="100" nowrap="nowrap" ><img src="mm_spacer.gif" alt="" width="15" height="1" border="0" /></td>
<td height="100" colspan="3" class="logo" nowrap="nowrap"><br />
<center>GESTION D'AVANCEMENT ET REPARTITION DES SALLES </center></td>
<td width="40"> </td>
<td width="100%"> </td>
</tr>

<tr bgcolor="#003399">
<td width="15" nowrap="nowrap"> </td>
<td height="36" colspan="3" id="navigation" nowrap="nowrap" class="navText"></a>     
<a href="prestation.php">PRESTATION</a>      <a href="affectation.php">AFFECTATION DES SALLES</a>  
    <a href="rechersalle.html">RAPPORT AFFECTATION</a>      <a href="FRechercher.html">RAPPORT D'AVANCEMENT DES COURS</a>     
<img src="accueil.png"/><a href="index.html">ACCUEIL</a>          </td>
<td width="40"> </td>
<td width="100%"> </td>
</tr>

<tr bgcolor="#ffffff">
<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>

<tr bgcolor="#ffffff">
<td width="230" colspan="2" valign="top" bgcolor="#ffffcc"><img src="logo_accueil.jpg" alt="Home Page Image" width="360" height="330" border="0" />
<table border="0" cellspacing="0" cellpadding="0" width="230">
<tr>
<td width="15"> </td>
<td width="200" class="smallText" id="padding">Institut Supérieur de Statistique<br />Bureau de la section
 <br /> </td>
<td width="15"> </td>
</tr>
</table> </td>
<td width="50" valign="top"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td width="440" valign="top"><br />
 <br />
<table border="1" cellspacing="4" cellpadding="5" width="450">
<tr>
<td class="pageHeader"align="center"colspan="2"id="th"><u><i><b>Enregistrement de la prestation</b></i><u></td>
</tr>
<tr><br/><br/>
<td></td>
<td><input type="hidden" name="id"/></td>
</tr>
<tr>
<td>Nom cours</td>
<td><select name="nomcours" id="nomcours" required/>
<optgroup label="nom du cours"></optgroup>
<?php
mysql_connect('localhost','root','');
mysql_select_db('dbavancement');
$a="select nomcours from cours";
$b=mysql_query($a);
while($tablo=mysql_fetch_array($b))
echo"<option>".$tablo['nomcours'];
?>
<tr>
<td>Matricule Enseignant</td>
<td><select name="matens" id="matens" required/>
<optgroup label="Matricule enseignant"></optgroup>
<?php
mysql_connect('localhost','root','');
mysql_select_db('dbavancement');
$a="select matens from enseignant";
$b=mysql_query($a);
while($tablo=mysql_fetch_array($b))
echo"<option>".$tablo['matens'];
?>
</tr>
<tr>
<td>Nom Salle</td>
<td><select name="nomsalle" id="nomsalle" required/>
<optgroup label="Nom de la salle"></optgroup>
<?php
mysql_connect('localhost','root','');
mysql_select_db('dbavancement');
$a="select nomsalle from salle";
$b=mysql_query($a);
while($tablo=mysql_fetch_array($b))
echo"<option>".$tablo['nomsalle'];
?>
</tr>
<tr>
<tr>
<td>Nom Promotion</td>
<td><select name="nomprom" id="nomprom" required/>
<optgroup label="Nom de la promotion"></optgroup>
<?php
mysql_connect('localhost','root','');
mysql_select_db('dbavancement');
$a="select nomprom from promotion";
$b=mysql_query($a);
while($tablo=mysql_fetch_array($b))
echo"<option>".$tablo['nomprom'];
?>
</tr>
<tr>
<td>Nom Departement</td>
<td><select name="nomdep" id="nomdep" required/>
<optgroup label="Nom du département"></optgroup>
<?php
mysql_connect('localhost','root','');
mysql_select_db('dbavancement');
$a="select nomdep from departement";
$b=mysql_query($a);
while($tablo=mysql_fetch_array($b))
echo"<option>".$tablo['nomdep'];
?>
</tr>
<tr>
<td>Volume Horaire</td>
<td><input type="text" name="volhoraire"required/></td>
</tr>
<tr>
<td>Heure Prestee</td>
<td><input type="text" name="heureprestee"required/></td>
</tr>
<tr>
<td>Heure Restante</td>
<td><input type="text" name="heurerestante"required/></td>
</tr>
<tr>
<td>Date</td>
<td><input type="text" name="datep"class="calendrier"required/></td>
</tr>
<tr>
<td></td>
<td><input type="hidden" name="Remarque"value="Ce cours avance bien"/></td>
</tr>
<tr>
<td class="bodyText"colspan="2">
 <br /> </td>
</tr>

</table>
</form>
<center><fieldset><input type="submit" value="Enregistrer"/>               
<input type="reset" value="Annuler"/></fieldset></center><br/><br/>
<td width="40"> </td>
<td width="100%"> </td>
</tr>

<tr bgcolor="#ffffff">
<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>

<tr>
<td colspan="6"> </td>
</tr>


<tr bgcolor="#003399">
<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>

<tr>
<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>

<tr bgcolor="#003399">
<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>


<tr>
<td width="15"> </td>
<td width="215"> </td>
<td width="50"> </td>
<td width="440"> </td>
<td width="40"> </td>
<td width="100%"> </td>
</tr>
</table>
</body>
</html>

LISTE DES PRESTATIONS

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Title here!</title>
<script language="javascript">
function imprimer()
{window.print();
}
</script>
</head>
<body bgcolor="khaki"><center>

<?php
include("connexion1.php");
if (isset($_POST['recherche'])){
$mot=$_POST['mot'];
$req="SELECT matens, nomcours, nomprom,nomdep,heureprestee,volhoraire,(volhoraire-heureprestee) as heurerestante FROM prestation WHERE nomcours='$mot'or matens='$mot'";
$res=mysql_query($req) or die(mysql_error());
echo'<h1>Votre rapport d\'avancement</h1>';
echo'<table border>';
echo'<tr>';
echo'<th><font color=firebrick>Matricule de l\'ensegnant</th>';
echo'<th><font color=firebrick>Nom du cours</th>';
echo'<th><font color=firebrick>Promotion</th>';
echo'<th><font color=firebrick>Departement</th>';
echo'<th><font color=firebrick>volume horaire</th>';
echo'<th><font color=firebrick>heure prestee</th>';
echo'<th><font color=firebrick>heure restante</th>';
echo'</tr>';
while($k=mysql_fetch_array($res))
{echo'<tr>';
echo'<td><font color=blue>'.$k['matens'].'</td>';
echo'<td><font color=blue>'.$k['nomcours'].'</td>';
echo'<td><font color=blue>'.$k['nomprom'].'</td>';
echo'<td><font color=blue>'.$k['nomdep'].'</td>';
echo'<td><font color=blue>'.$k['volhoraire'].' '.'h'.'</td>';
echo'<td><font color=blue>'.$k['heureprestee'].' '.'h'.'</td>';
echo'<td><font color=blue>'.$k['heurerestante'].' '.'h'.'</td>';
echo'</tr>';
}
echo'</table>';
echo'<br/>';
echo'<input type=button value=Imprimer onclick=imprimer()>';
echo'          ';
echo'<a href=index.html>page d accueil</a>';
}
else
echo 'Aucun resultat trouvé!!!';

?>

</body>
</html>

1 réponse

jordane45 Messages postés 38145 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 25 avril 2024 344
5 mars 2016 à 12:35
Bonjour,

1 - **** Attention ****
Merci de bien vouloir utiliser la coloration syntaxique (les balises de code) lorsque tu postes du code sur le forum.
Explications disponibles ici :
http://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code

2 - Tu utilises l'ancienne extension mysql considérée comme obsolète.
Je t'invite à lire ceci : http://www.commentcamarche.net/faq/43261-php-l-extension-mysql-est-obsolete#top
puis à passer à mysqli ou à la PDO
http://www.commentcamarche.net/faq/44117-connexion-a-une-base-avec-pdo-mysqli

3 - Sur quoi bloques tu exactement ? que n'arrives tu pas à faire précisément ?
Quelle partie de ton code ne fonctionne pas ? As-tu des messages d'erreur ?


0
Rejoignez-nous