-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajouterCategorie.php
More file actions
51 lines (41 loc) · 1.15 KB
/
ajouterCategorie.php
File metadata and controls
51 lines (41 loc) · 1.15 KB
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
<html>
<head>
<title>Pirate Book</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<header>
<center><h1>Ajout Catégorie</h1></center>
<nav>
<ul>
<li><a href="accueil.html">Rechercher livre</a></li>
<li><a href="auteur.html">Rechercher auteur</a></li>
<li><a href="profilUtilisateur.php">Mon profil</a></li>
<li><a href="pageIdentificationUtilisateur.html">Se connecter</a></li>
<li><a href="don.html">Faire un don</a></li>
<li><a href="pageVedettes.php">Livres en Vedette</a></li>
<ul/>
</nav>
</header>
<?php
$nom=$_POST['nomCategorie'];
$description=$_POST['descriptionCategorie'];
/** Connexion **/
$dbUser = 'nf17p165';
$userPw = 'wUANb2Da';
$vConn = new PDO('pgsql:host=tuxa.sme.utc;port=5432;dbname=dbnf17p165', $dbUser, $userPw);
/** Préparation et exécution de la requête **/
$sql = "INSERT INTO Categorie (nom, description)
VALUES ('$nom', '$description')";
$result = $vConn->prepare($sql);
$result->execute();
/** Traitement du résultat **/
if ($result) {
echo "Insertion de $nom";
}
else {
echo "Erreur lors de l'insertion";
}
/** Déconnexion **/
$vConn=null;
?>
</html>