-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
75 lines (65 loc) · 2.54 KB
/
index.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
<?php
include 'others/header.php';
?>
<div class="container bg-white">
<?php
include 'conndb.php';
$query = "SELECT * FROM user_table";
$result = $db -> query($query);
?>
<div class="row" style="margin-top: 30px; margin-bottom: 10px;">
<div class="col-sm-4">
<h4>Insert New User</h4>
<form action="insert.php" method="post">
<div class="form-group">
<label for="uname" class="text-info">User Name:</label>
<input type="text" class="form-control" name="uname">
</div>
<div class="form-group">
<label for="uemail" class="text-info">Email ID:</label>
<input type="email" class="form-control" name="uemail">
</div>
<div align="center">
<button type="submit" class="btn btn-primary">Insert</button>
</div>
</form>
</div>
<div class="col-sm-8">
<h4>All User Display in the Table</h4>
<table class="table table-striped">
<thead>
<tr>
<th>User ID</th>
<th>User Name</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
//Here we Read the data base from the variable result
//while (true)
//fetchArray return false when there is not more elements in the array
while ($row = $result->fetchArray()) {
?>
<tr>
<!-- <td>John</td>-->
<td><?php echo $row['user_id']; ?></td>
<td><?php echo $row['user_name']; ?></td>
<td><?php echo $row['user_email']; ?></td>
<td>
<a href="update.php?u_id=<?php echo $row['user_id'];?>" class="btn btn-info" role="button">Update</a>
<a href="delete.php?u_id=<?php echo $row['user_id'];?>" class="btn btn-danger" role="button">Delete</a>
</td>
</tr>
<?php
}
?>
<?php
?>
</tbody>
</table>
</div>
</div>
</div>
<?php include 'others/footer.php' ?>