This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayStatuses.php
80 lines (75 loc) · 3.3 KB
/
DisplayStatuses.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
<?php
include('session.php');
include('SQLFunctions.php');
$table = 'status';
$title = "SVBX - Display Status Types";
include('filestart.php');
$link = f_sqlConnect();
if(!f_tableExists($link, $table, DB_NAME)) {
die('<br>Destination table does not exist: '.$table);
}
$sql = "SELECT statusID, statusName, lastUpdated, updatedBy FROM $table ORDER BY StatusID";
$sql1 = "SELECT COUNT(*) FROM $table";
if($result = mysqli_query($link,$sql1)) {
echo" <header class='container page-header'>
<h1 class='page-title'>Status Types</h1><br />
<table class='sumtable'>
<tr class='sumtr'>
<td class='sumtd'>Status Types: </td>";
while ($row = mysqli_fetch_array($result)) {
echo "<td class='sumtd'>{$row[0]}</td>";
}
echo "</table><br></header>";
}
if($result = mysqli_query($link,$sql)) {
echo"
<div class='container main-content'>
<table class='table'>
<tr class='usertr'>
<th class='userth'>Status ID</th>
<th class='userth'>Status</th>";
if(!isset($_SESSION['userID']))
{
echo "</tr>";
} else {
echo "
<th class='userth'>Last Updated</th>
<th class='userth'>Last Updated By</th>
<th class='userth'>Edit</th>";
if($role >= 40) {
echo "
<th class='userth'>Delete</th>";
}
echo "
</tr>";
}
while ($row = mysqli_fetch_array($result)) {
echo" <tr class='usertr'>
<td style='text-align:center' class='usertd'>{$row[0]}</td>
<td class='usertd'>{$row[1]}</td>";
if(!isset($_SESSION['userID']))
{
echo "</tr>";
} else {
echo "
<td class='usertd'>{$row[2]}</td>
<td class='usertd'>{$row[3]}</td>
<td class='usertd'><form action='UpdateStatus.php' method='POST' onsubmit=''/>
<input type='hidden' name='q' value='".$row[0]."'/><input type='submit' value='Update'></form></td>";
if($role >= 40) {
echo "
<td class='usertd'><form action='DeleteStatus.php' method='POST' onsubmit='' onsubmit='' onclick='return confirm(`do you want to delete {$row[1]} Status`)'/>
<button type='Submit' name='q' value='".$row[0]."'><i class='typcn typcn-times'></i></button></form></td>";
}
echo "</tr>";
}
}
echo "</table></div>";
}
mysqli_free_result($result);
if(mysqli_error($link)) {
echo '<br>Error: ' .mysqli_error($link);
} else //echo '<br>Success';
mysqli_close($link);
include 'fileend.php';
?>