1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<?php
mysql_connect("localhost", "root", ""); // Connexion à MySQL
mysql_select_db("alu"); // Sélection de la base
$statut_demande="En cours";
$reponse=mysql_query("SELECT d.nom_projet as nom_projet, COUNT(d1.id_demande) as nb_demandes, COUNT(d2.id_demande) as nb_deamndes_encours FROM demande_projet d1
INNER JOIN projet d ON d.id_projet = d1.id_projet
INNER JOIN demande d2 ON d2.id_demande = d1.id_demande AND d2.statut_demande = '".$statut_demande."'
GROUP BY d.nom_projet")or die( mysql_error() );
echo "<table width=\"435\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr>
<td height=\"22\"> </td>
<td valign=\"top\" bgcolor=\"#6699FF\"><b>Nom projet</b> </td>
<td> </td>
<td valign=\"top\" bgcolor=\"#6699FF\"><b>Nombre de demandes</b> </td>
<td> </td>
<td valign=\"top\" bgcolor=\"#6699FF\"><b>Demandes en cours</b> </td>
<td> </td>
</tr>";
while ($donnees = mysql_fetch_array($reponse))
{
echo '<td height="22"> </td>
<td valign="top">'.$donnees['nom_projet'].' </td>
<td> </td>
<td valign="top">'.$donnees['nb_demandes'].' </td>
<td> </td>
<td valign="top">'.$donnees['nb_deamndes_encours'].' </td>
<td> </td>
</tr>';
}
echo "</table>";
mysql_close(); // Déconnexion de MySQL
?> |
Partager