-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassTaux.php
68 lines (54 loc) · 1.88 KB
/
classTaux.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
66
67
68
<?php
class Change {
public $idChange;
private $chilling;
private $rwandais;
private $cdf;
public $message;
function __construct($idChange, $chilling, $rwandais, $cdf) {
$this->idChange = $idChange;
$this->chilling = $chilling;
$this->rwandais = $rwandais;
$this->cdf = $cdf;
}
function updateTaux() {
include 'connexion.php';
$updC= ("UPDATE `Change` SET `Chilling` = $this->chilling WHERE idChange =$this->idChange");
if(mysqli_query($db,$updC)){echo"";}else{
$this->message = mysqli_error($db);
return;
}
$updC1= ("UPDATE `Change` SET `Rwandais` = $this->rwandais WHERE idChange =$this->idChange");
if(mysqli_query($db,$updC1)){echo"";}else{
$this->message = mysqli_error($db);
return;
}
$updC2= ("UPDATE `Change` SET `CDF` = $this->cdf WHERE idChange =$this->idChange");
if(mysqli_query($db,$updC2)){echo"";}else{
$this->message = mysqli_error($db);
return;
}
}
}
$q = $_REQUEST["q"];
$tabC = explode("::", $q);
$autre = '';
if(end($tabC) == 'update') {
if ($q !== "") {
$hint = $q;
$salaire = new Change($tabC[0], $tabC[1], $tabC[2], $tabC[3]);
$salaire->updateTaux();
$autre = $salaire->message;
if( $salaire->message) {
$hint = $autre;
}
}
$sucess = '<div class="alert alert-success" role="alert">
Modification fait avec success
</div>';
$error = '<div class="alert alert-danger" role="alert">
Erreur '.$autre.'
</div>';
echo $hint == $autre ? $error : $sucess;
}
?>