-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoveMaterial.php
More file actions
43 lines (29 loc) · 971 Bytes
/
removeMaterial.php
File metadata and controls
43 lines (29 loc) · 971 Bytes
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
<?php
require_once("dbConnExec.php");
require_once('headerFunctions.php');
if (is_null($projectId) || empty($projectId)) {
$projectId = $_POST["id"];
}
$materialId = $_POST["materialId"];
$errorMessages = '';
if(! empty($_POST)) {
if(empty($projectId)) {
$errorMessages .= "<li>Project Id is a required field.</li>";
}
if(empty($materialId)) {
$errorMessages .= "<li>Material Id is a required field.</li>";
}
if(empty($errorMessages)) {
$conn = dbConnect();
$query = $conn->prepare('delete from projectMaterial where projectId = :projectId and MaterialId = :materialId');
$query->bindParam(':projectId', trim($projectId));
$query->bindParam(':materialId', trim($materialId));
$query->execute();
dbDisconnect($conn);
unset($materialId);
unset($materialCost);
unset($materialQuantity);
}
}
require_once('project.php');
?>