medicaments.php 1.33 KB
Newer Older
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
1
2
<html>
<head>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
3
  <title>Clinique Vétérinaire</title>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
4
5
6
7
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" type="text/css" href="style.css">
  </head>
<body>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
8
9
  <h1>Information sur les médicaments</h1>
  <form action='statMedicaments.php' method='post'>  <input  type='submit' value='Statistiques générales'> </form>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
10
11
  <table border="1">
    <tr>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
12
13
      <th>Nom médicament</th>
      <th>Description</th>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
14
      <th>Statistique</th>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
15
16
17
    </tr>
    <?php
    // Connexion à la base de données
Gaetan Carabetta's avatar
Gaetan Carabetta committed
18
    include("connexion.php");
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
19
20
21
22

    try{
      $vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
    } catch(PDOException $e){
Gaetan Carabetta's avatar
Gaetan Carabetta committed
23
      echo "Erreur de connexion '$e'";
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
24
25
26
    }

    // Affichage du tableau de données
Gaetan Carabetta's avatar
Gaetan Carabetta committed
27
    $vSql = "select * from medicament";
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
28
29
30
31
32
33
34
35
    try{
      $vSt = $vConn->prepare($vSql);
      $vSt->execute();

      while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
        echo '<tr>';
        echo "<td>$vResult[0]</td>";
        echo "<td>$vResult[1]</td>";
Gaetan Carabetta's avatar
Gaetan Carabetta committed
36
        echo "<td><form action='statMedicament.php' method='post'> <input type='text' name='nomMolec' value=$vResult[0] hidden/> <input  type='submit' value='Statistiques'> </form></td>";
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
37
38
39
40
41
42
43
44
45
46
47
        echo '</tr>';
      }

    } catch(PDOException $e){
      echo "Erreur de requete '$e'";
    }
    ?>

  </table>
</body>
</html>