index.php 1.36 KB
Newer Older
Gaetan Carabetta's avatar
Gaetan Carabetta committed
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
<html>
<head>
  <title>Clinique Veterinaire</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
<body>
  <h1>Gestion de la clinique</h1>
  <table border="1">
    <tr><th>Numéro</th><th>Nom</th><th>Population</th></tr>
    <?php
    // Connexion à la base de données
    $vHost = 'tuxa.sme.utc';
    $vPort = '5432';
    $vData = 'dbbdd0p042';
    $vUser = 'bdd0p042';
    $vPass = 'cyLu9JFl';
    $vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
    // Affichage du tableau de données
    // $vSql ='';
    // $vSt = $vConn->prepare($vSql);
    // $vSt->execute();
    // while ($vResult = $vSt->fetch(PDO::FETCH_ASSOC)) {
    //   echo '<tr>';
    //   echo "<td>$vResult[]</td>";
    //   echo "<td>$vResult[]</td>";
    //   echo "<td>$vResult[]</td>";
    //   echo '</tr>';
    // }
    ?>
  </table>
  <ul>
  <?php
    $vSql ='';    
    $vSt = $vConn->prepare($vSql);
    $vSt->execute();    
    $vResult = $vSt->fetch(PDO::FETCH_ASSOC);
    echo "<li>Département le plus peuplé : <b>$vResult[__________]</b></li>";

    $vSql ='______________________________________________________________';
    $vSt = $vConn->prepare($vSql);
    $vSt->execute();    
    $vResult = $vSt->fetch(PDO::FETCH_ASSOC);
    echo "<li>Département le moins peuplé : <b>$vResult[__________]</b></li>";
  ?>
  </ul>
</body>
</html>