Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gaetan Carabetta
projet_nf17_p19_tdg1_groupe2
Commits
a9285c94
Commit
a9285c94
authored
Jun 20, 2019
by
Oswaldo Aldair Alanis Mayorga
Browse files
Upload New File
parent
9fb14d3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
application/ajouterClient.php
0 → 100644
View file @
a9285c94
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Insert Client
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
</head>
<body>
<table
border =
"1"
>
<tr>
<th>
nom
</th>
<th>
prenom
</th>
<th>
ddn
</th>
<th>
adresse
</th>
<th>
numero
</th>
</tr>
<?php
include
(
"connexion.php"
);
$nom
=
$_POST
[
'nom'
];
$prenom
=
$_POST
[
'prenom'
];
$ddn
=
$_POST
[
'ddn'
];
$add
=
$_POST
[
'add'
];
$ntel
=
$_POST
[
'ntel'
];
try
{
$vConn
=
new
PDO
(
"pgsql:host=
$vHost
;port=
$vPort
;dbname=
$vData
"
,
$vUser
,
$vPass
);
}
catch
(
PDOException
$e
)
{
echo
"Erreur de la connexion '
$e
'"
;
}
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
');"
;
try
{
$vSt
=
$vConn
->
prepare
(
$vSql
);
$vSt
->
execute
();
}
catch
(
PDOException
$e
)
{
echo
"Erreur en l'insertion '
$e
'"
;
}
$vSql
=
'SELECT * FROM client;'
;
try
{
$vSt
=
$vConn
->
prepare
(
$vSql
);
$vSt
->
execute
();
}
catch
(
PDOException
$e
)
{
echo
"Erreur en l'affichage des clients '
$e
'"
;
}
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>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment