-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremoveProject.php
51 lines (34 loc) · 1.2 KB
/
removeProject.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
<?php
require_once("dbConnExec.php");
require_once('headerFunctions.php');
if (is_null($projectId) || empty($projectId)) {
$projectId = $_GET["id"];
}
$errorMessages = '';
if(! empty($_GET)) {
if(empty($projectId)) {
$errorMessages .= "<li>Project Id is a required field.</li>";
}
if(empty($errorMessages)) {
// make sure that the user name is not already being used
$conn = dbConnect();
$query = $conn->prepare('delete from projectMaterial where projectId = :projectId');
$query->bindParam(':projectId', trim($projectId));
$query->execute();
$query = $conn->prepare('delete from projectLaborItem where projectId = :projectId');
$query->bindParam(':projectId', trim($projectId));
$query->execute();
$query = $conn->prepare('delete from project where projectId = :projectId');
$query->bindParam(':projectId', trim($projectId));
$query->execute();
$query->execute();
dbDisconnect($conn);
redirect('home.php');
}
}
if (!empty($errorMessages)) {
echo('<ul class="errorMessage">');
echo($errorMessages);
echo('</ul><br/>');
}
?>