Replace insertClient.php

parent af934bd7
......@@ -7,7 +7,6 @@
<body>
<table border = "1">
<tr>
<th> id </th>
<th> nom </th>
<th>prenom</th>
<th> ddn </th>
......@@ -15,38 +14,67 @@
<th> numero </th>
</tr>
<?php
//include("connexion.php");
$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p020';
$vUser = 'bdd0p020';
$vUser = 'bdd0p020';
$vPass = 'uLd6pAgM';
$nom = $_POST('nom');
$prenom = $_POST('prenom');
$ddn = $_POST('ddn');
$add = $_POST('add');
$ntel = $_POST('ntel');
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$ddn = $_POST['ddn'];
$add = $_POST['add'];
$ntel = $_POST['ntel'];
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
if($nom)
{
if ($prenom)
{
if ($ddn)
{
if ($add)
{
if ($ntel)
{
$vSql ="INSERT INTO Client (nom,prenom,ddn,adresse,numero) VALUES ( '$nom','$prenom','$ddn','$add','$ntel');"; $vSt = $vConn->prepare($vSql);
$vSt->execute();
$vSql ='INSERT INTO client (nom, prenom, ddn, adresse, numeero) VALUES('$nom', '$prenom', '$ddn', '$add', '$ntel')';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
$vSql ='SELECT * FROM client';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_ASSOC)) {
echo '<tr>';
echo "<td>$vResult[idClient]</td>";
echo "<td>$vResult[nom]</td>";
echo "<td>$vResult[prenom]</td>";
echo "<td>$vResult[ddn]</td>";
echo "<td>$vResult[adresse]</td>";
echo "<td>$vResult[numero]</td>";
echo '</tr>';
}*/
$vSql ='SELECT * FROM client';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_ASSOC))
{
echo '<tr>';
echo "<td>$vResult[nom]</td>";
echo "<td>$vResult[prenom]</td>";
echo "<td>$vResult[ddn]</td>";
echo "<td>$vResult[adresse]</td>";
echo "<td>$vResult[numero]</td>";
echo '</tr>';
}
}
}
else
echo "Il faut de donner le numero de telephone";
}
else
echo "Il faut de donner l'addresse";
}
else
echo "Il faut de donner le prenom";
}
else
echo "Il faut de donner le nom";
?>
</table>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment