traitements.php 1.07 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 traitements</h1>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
9
10
  <table border="1">
    <tr>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
11
      <th>idTraitement</th>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
12
      <th>idAnimal</th>
Gaetan Carabetta's avatar
Gaetan Carabetta committed
13
      <th>idVeterinaire</th>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
14
15
16
    </tr>
    <?php
    // Connexion à la base de données
Gaetan Carabetta's avatar
Gaetan Carabetta committed
17
    include("connexion.php");
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
18
19
20
21

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

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

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

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

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