classes.php 969 Bytes
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 sur les classes</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>Nom Classe</th>
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
12
13
14
    </tr>
    <?php
    // Connexion à la base de données
Gaetan Carabetta's avatar
Gaetan Carabetta committed
15
    include("connexion.php");
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
16
17
18
19

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

    // Affichage du tableau de données
Gaetan Carabetta's avatar
Gaetan Carabetta committed
24
    $vSql = "select * from ClasseEspece";
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
25
26
27
    try{
      $vSt = $vConn->prepare($vSql);
      $vSt->execute();
Gaetan Carabetta's avatar
Gaetan Carabetta committed
28
      
Osvaldo Valdivia Salas's avatar
Osvaldo Valdivia Salas committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
      while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
        echo '<tr>';
        echo "<td>$vResult[0]</td>";
        echo '</tr>';
      }

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

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