-
Notifications
You must be signed in to change notification settings - Fork 1
/
Spec.php
executable file
·65 lines (52 loc) · 1.54 KB
/
Spec.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
class Spec
{
private $pdo;
private $id_spec;
private $spec;
private $groupes;
function __construct()
{
try {
$this->pdo = new PDO("mysql:host=localhost;dbname=database", "root", "");
} catch (PDOException $e) {
echo $e->getMessage();
}
}
public static function getSpecTable()
{
$pdo = new PDO("mysql:host=localhost;dbname=database", "root", "");
return $pdo->query("select * from specs")->fetchAll(PDO::FETCH_ASSOC);
}
public function delSpec(){
$this->pdo->query("delete from specs where id_spec='$this->id_spec'");
}
public function addSpec()
{
$this->pdo->query("insert into specs (spec, groupes) values ('$this->spec','$this->groupes')");
}
public function getSpec()
{
return $this->spec;
}
public function setSpec($spec)
{
$this->spec = $spec;
}
public function getGroupes()
{
return $this->pdo->query("select groupes from specs where spec='$this->spec'")->fetch(PDO::FETCH_ASSOC)['groupes'];
}
public function setGroupes($groupes)
{
$this->groupes = $groupes;
}
public function getIdSpec()
{
return $this->id_spec;
}
public function setIdSpec($id_spec)
{
$this->id_spec = $id_spec;
}
}