insertClient.php 1.31 KB
Newer Older
Oswaldo Aldair Alanis Mayorga's avatar
Oswaldo Aldair Alanis Mayorga 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
48
49
50
51
52
53
54
55
56
57
58
<?php
  // Connexion à la base de données
  $vNom = $_GET['nom'];
  $vPrenom = $_GET['Prenom'];
  $vddn = $_GET['ddn'];
  $vadd = $_GET['add'];
  $vTel = $_GET['nTel'];
  $vHost = 'tuxa.sme.utc';
  $vPort = '5432';
  $vData = 'dbbdd0p020';
  $vUser = 'bdd0p020';
  $vPass = 'uLd6pAgM';
  $vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);

  if($vNom)
  {
    if($vPrenom)
    {
      if($vddn)
      {
        if($vTel)
        {
          $query = "INSERT INTO client(nom, prenom, ddn, adresse, numero) VALUES('$vNom', '$vPrenom', '$vddn', '$vadd', '$vTel')";
          $vSt = $vConn->prepare($query);
          $vSt->execute();

          $query = "SELECT * FROM client";
          $vSt = $vConn->prepare($query);
          $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>';
    }

          echo "Insertion Correct";
        }
      }
    }
  }



?>

<html>

  <head>  <title> Insert Client </title> </head>
  <body>
    <table border = "1">
      <tr> <th>id</th> <th> Nom </th> <th> Prenom </th> <th> Date </th> <th> Adresse </th> <th> Numero </th> </tr>
    </table>
  </body>

</html>