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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| <?php
// information pour la connection à la DB
$host = 'localhost';
$user = 'root';
$pass = 'mysql';
$db = 'gdi';
// connection à la DB
$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());
// requête SQL qui compte le nombre total d'enregistrement dans la table et qui
//récupère tous les enregistrements
$select = 'SELECT num_int,date,heure,structure,service,section,demandeur,tel,code_bureau,type_equip,cat_interv,description FROM di_attente where etat="en attente"';
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
// si on a récupéré un résultat on l'affiche.
if($total) {
// debut du tableau
echo '<table bgcolor="#FFFFFF">'."\n";
// première ligne on affiche les titres prénom et surnom dans 2 colonnes
echo '<tr>';
echo '<td bgcolor="#669999"><b><u>num_int</u></b></td>';
echo '<td bgcolor="#669999"><b><u>date</u></b></td>';
echo '<td bgcolor="#669999"><b><u>heure</u></b></td>';
echo '<td bgcolor="#669999"><b><u>structure</u></b></td>';
echo '<td bgcolor="#669999"><b><u>service</u></b></td>';
//echo '<td bgcolor="#669999"><b><u>section</u></b></td>' ;
echo '<td bgcolor="#669999"><b><u>demandeur</u></b></td>' ;
echo '<td bgcolor="#669999"><b><u>tel</u></b></td>' ;
//echo '<td bgcolor="#669999"><b><u>code_bur</u></b></td>' ;
echo '<td bgcolor="#669999"><b><u>type_equip</u></b></td>' ;
echo '<td bgcolor="#669999"><b><u>cat_interv</u></b></td>' ;
echo '<td bgcolor="#669999"><b><u>description</u></b></td>' ;
echo '</tr>'."\n";
// lecture et affichage des résultats sur 2 colonnes, 1 résultat par ligne.
while($row = mysql_fetch_array($result)) {
echo '<tr>';
echo '<td bgcolor="#CCCCCC"><a href="gdi_detail.php?num_int='.$row["num_int"].'">'.$row["num_int"].'</a></td>';
echo '<td bgcolor="#CCCCCC">'.$row["date"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["heure"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["structure"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["service"].'</td>';
//echo '<td bgcolor="#CCCCCC">'.$row["section"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["demandeur"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["tel"].'</td>';
//echo '<td bgcolor="#CCCCCC">'.$row["code_bureau"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["type_equip"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["cat_interv"].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row["description"].'</td>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
// fin du tableau.
}
else echo ' table vide...';
// on libère le résultat
mysql_free_result($result);
?> |
Partager