-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodetable.php
More file actions
70 lines (54 loc) · 1.77 KB
/
Copy pathcodetable.php
File metadata and controls
70 lines (54 loc) · 1.77 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
include('dbconfig.php');
session_start();
if(isset($_POST['registerbtn']))
{
$codebare = $_POST['codebare'];
$emplacement = $_POST['emplacement'];
$equipement = $_POST['equipement'];
$villeID = $_SESSION['villeID'];
$query = "INSERT INTO materiel (Codebare,Emplacement,Equipement,VilleID) VALUES ('$codebare','$emplacement','$equipement','$villeID')";
$query_run = mysqli_query($connection,$query);
if ($query_run){
$_SESSION['success'] = "Matériel a été ajouté";
header('location: tables.php');
}
else{
$_SESSION['status'] = "Matériel n'a été ajouté";
header('location: tables.php');
}
}
if(isset($_POST['updatebtn']))
{
$ID = $_POST['edit_id'];
$codebare = $_POST['edit_codebare'];
$emplacement = $_POST['edit_emplacement'];
$equipement = $_POST['edit_equipement'];
$comptoir = $_POST['edit_comptoir'];
$query = "UPDATE materiel SET Codebare='$codebare',Emplacement='$emplacement',Equipement='$equipement' WHERE ID='$ID' ";
$query_run = mysqli_query($connection, $query);
if($query_run){
$_SESSION['success'] = "Your data is updated";
header('location: tables.php');
}else{
$_SESSION['status'] = "Your data is not updated";
header('location: tables.php');
}
}
if(isset($_POST['delete_btn']))
{
$ID = $_POST['delete_id'];
$query = "DELETE FROM materiel WHERE ID='$ID' ";
$query_run = mysqli_query($connection, $query);
if($query_run)
{
$_SESSION['success'] = "Matériel a été supprimer";
header('location: tables.php');
}
else
{
$_SESSION['status'] = "Matériel n'a été supprimer";
header('location: tables.php');
}
}
?>