-
Notifications
You must be signed in to change notification settings - Fork 6
/
delete.php
98 lines (86 loc) · 2.39 KB
/
delete.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
<?php
function fetch_data()
{
$output = '';
$conn = mysqli_connect("localhost", "root", "", "project");
$sql = "SELECT * FROM symbols ORDER BY email";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result))
{
$output .= '<tr>
<td>'.$row["id"].'</td>
<td>'.$row["name"].'</td>
<td>'.$row["title"].'</td>
<td>'.$row["email"].'</td>
<td>'.$row["year"].'</td>
<td>'.$row["gender"].'</td>
<td>'.$row["fromdate"].'</td>
<td>'.$row["todate"].'</td>
<td>'.$row["people"].'</td>
</tr>
';
}
return $output;
}
?>
<?php include('header.php'); ?>
<center>
<h3 style="padding: 30px;">Delete Registration entry:</h3>
<form action ="dodelete.php" method="post" style="padding-bottom: 40px;">
<div class="input-group col-6">
<input type="int" name="id" class="form-control" placeholder="Enter id of the entry to be deleted" required>
<span class="input-group-btn">
<button class="btn btn-secondary" type="submit" value="submit">Delete!</button>
</span>
</div>
</div>
</form>
<h3 style="padding: 20px;">Records In Database:</h3>
<div class="table-responsive table-hover table-bordered col-10" >
<table class="table" >
<thead >
<tr class="table-primary">
<th width="1%">Id</th>
<th width="1%">Name</th>
<th width="1%">Event</th>
<th width="1%">Email</th>
<th width="1%">Year</th>
<th width="1%">Gender</th>
<th width="1%">From date</th>
<th width="1%">To date</th>
<th width="1%">No of people</th>
</tr>
<tbody>
<?php
echo fetch_data();
?>
</tbody>
</table>
</thead>
</table>
</div>
</div>
</center>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "project";
$conn = new mysqli($servername, $username, $password, $dbname);
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM symbols";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
<?php include('footer.php'); ?>