-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArticle.php
51 lines (45 loc) · 1.87 KB
/
Article.php
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
<?php
class Article
{
public $id;
public $natureMateriel;
public $reference;
public $description;
public function __construct($natureMateriel, $reference, $description){
$this->natureMateriel = $natureMateriel;
$this->reference = $reference;
$this->description = $description;
}
public function supprimerArticle(){
include("connexion1.php");
$idconn = connexpdo('espoirPauvre','myparam');
$reqprep = $idconn->prepare("DELETE from article where id_Article=:id");
$reqprep->bindValue(':id',$id,PDO::PARAM_INT);
$reqprep->execute();
$reqprep->closeCursor();
}
public function mettreAJour(){
include("connexion1.php");
$idconn = connexpdo('espoirPauvre','myparam');
$reqprep = $idconn->prepare("UPDATE article SET NatureMateriel=:natureMateriel,Reference=:reference,
Description=:descr WHERE id_Article=:id");
$reqprep->bindValue(':id',$id,PDO::PARAM_INT);
$reqprep->bindValue(':natureMateriel',$natureMateriel,PDO::PARAM_STR);
$reqprep->bindValue(':reference',$reference,PDO::PARAM_STR);
$reqprep->bindValue(':descr',$description,PDO::PARAM_STR);
$reqprep->execute();
$reqprep->closeCursor();
}
public function ajouterArticle(){
include("connexion1.php");
$idconn = connexpdo('espoirPauvre','myparam');
$reqprep = $idconn->prepare("INSERT into article(NatureMateriel,Reference,Description)
values(:natureMateriel,:reference,:descr);");
$reqprep->bindValue(':natureMateriel',$this->natureMateriel,PDO::PARAM_STR);
$reqprep->bindValue(':reference',$this->reference,PDO::PARAM_STR);
$reqprep->bindValue(':descr',$this->description,PDO::PARAM_STR);
$reqprep->execute();
$reqprep->closeCursor();
}
}
?>