medicaments.php 1.01 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
  <h1>Information des médicaments</h1>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
9
10
  <table border="1">
    <tr>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
11
12
      <th>Nom médicament</th>
      <th>Description</th>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
13
14
15
    </tr>
    <?php
    // Connexion à la base de données
Gaetan Carabetta's avatar
Gaetan Carabetta committed
16
    include("connexion.php");
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
17
18
19
20

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

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

Gaetan Carabetta's avatar
Gaetan Carabetta committed
30
      
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
      while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
        echo '<tr>';
        echo "<td>$vResult[0]</td>";
        echo "<td>$vResult[1]</td>";
        echo '</tr>';
      }

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

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