-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetdata.php
79 lines (58 loc) · 1.61 KB
/
getdata.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
<table class="table table-hover table-responsive">
<thead>
<tr>
<th>Sno<?php $sno=1;?></th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th colspan="2">Action</th>
</tr>
</thead>
<tbody>
<?php
include('conn/connection.php');
$GetAll_Data = "SELECT * FROM users";
$res = mysqli_query($conn,$GetAll_Data);
if(mysqli_num_rows($res) > 0){
while($rs = mysqli_fetch_assoc($res)){
?>
<tr>
<td><?php echo $sno++; ?></td>
<td><?php echo $rs['first_name']; ?></td>
<td><?php echo $rs['last_name']; ?></td>
<td><?php echo $rs['email']; ?></td>
<?php $id = $rs['id']; ?>
<td><?php echo "<a href='update_disease.php?id=$id'><button class='btn btn-warning'>Edit</button></a>"?></td>
<td><a href="#" id = "<?php echo $rs['id']; ?>" class="trash" >Del</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php include_once('inc/footer.php'); ?>
<script>
$(document).ready(function(){
$('.trash').click(function(){
var del_id = $(this).attr('id');
//alert(del_id);
var $ele = $(this).parent().parent();
var conf = confirm("Do You want to delete this");
if(conf){
$.ajax({
type:'POST',
url:'delete.php',
data:{del_id:del_id},
success: function(data){
if(data == "YES"){
$ele.fadeOut().remove();
}else{
alert("can't delete the row")
}
}
});
}
});
});
</script>