-
Notifications
You must be signed in to change notification settings - Fork 0
/
problemResolved.php
131 lines (120 loc) · 5.01 KB
/
problemResolved.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
session_start();
?>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="home.css">
<style>
* {
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
}
#window {
background-color: #ffffff;
margin: 100px auto;
font-family: Raleway;
padding: 40px;
width: 70%;
min-width: 300px;
}
</style>
<title>Problem Resolution</title>
<body>
<!-- NAVBAR -->
<nav class="navbar navbar-default navbar-dark bg-d">
<a class="navbar-brand" href="finalhomepage.php">Make-It-All</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="finalhomepage.php">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="logCall.html">Log Call</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="allProblems.html">Live Jobs</a>
</li>
<li class="nav-item">
<a class="nav-link" href="reports.php">Analytics</a>
</li>
</ul>
<ul>
<ul class="nav navbar-nav" style="float: right">
<button class="btn btn btn-danger" type="button" onclick="location.href = 'index.html'">Sign Out</button>
</ul>
</ul>
</div>
</nav>
<!-- END NAVBAR -->
<div id="window">
<p align="center" style="font-size:300%;">Problem Solved<span style="color: #007bff">✔</span></p>
<p align="center">
<?php
//Database Connection
$servername = "localhost";
$username = "root";
$password = "SIpnz0Sjel";
// Create connection
$conn = mysqli_connect($servername, $username, $password, 'team018');
//getter for problem number id for problem being resolved
$problemNumber = $_GET["problemNumber"];
//selecting the row in the problem table of the problem being resolved
$sql= "SELECT * FROM problem WHERE problem_no='".$_GET["problemNumber"]."'";
$res = mysqli_query($conn, $sql);
//Deleting the problem from the problem table in the database
$sql1= "DELETE FROM problem WHERE problem_no='".$problemNumber."'";
$sql2= "DELETE FROM live WHERE problem_no='".$problemNumber."'";
if (mysqli_query($conn, $sql1) && mysqli_query($conn, $sql2)) {
echo "";
} else {
echo "Error: " . $sql2 . "<br>" . mysqli_error($conn);
}
//Inserting the resolved problem into the resovled table
$sql3= "INSERT INTO resolved (problem_no, solution, date, notes, specialist_id) VALUES ('".$_GET["problemNumber"]."', '".$_GET["solution"]."', '".$_GET["date"]."', '".$_GET["notes"]."', '123')";
if (mysqli_query($conn, $sql3)) {
echo "";
} else {
echo "Error: " . $sql3 . "<br>" . mysqli_error($conn);
}
//Table showing the problem that was resolved
echo '<style>';
echo 'table { border-collapse: collapse;}';
echo '</style>';
echo '<table cellpadding="10", border="1">';
echo '<thead>';
echo '<tr>';
echo '<th>'."Problem Number".'</th>';
echo '<th>'."Type".'</th>';
echo '<th>'."Personnel ID".'</th>';
echo '<th>'."Solution".'</th>';
echo '</tr>';
echo '</thead>';
if (mysqli_num_rows($res) > 0) {
// output data of each row
while($row = mysqli_fetch_row($res)) {
echo "<tr>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[4] . "</td>";
echo "<td>" . $_GET["solution"] . "</td>";
echo "</tr>";
}
}
echo '</table>' ;
?>
<p align="center"><button type="button" class="btn btn-light" id="resolve problem" onclick="location.href = 'resolvedForm.html'">Resolve another problem?</button></p>
</div>
</div>
</body>
</html>