-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.php
94 lines (79 loc) · 2.9 KB
/
data.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Datatable</title>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css"/>
</head>
<body>
<table id="donations">
<thead>
<tr style="background-color: rgb(20,107,164);color:white;">
<th>Date</th>
<th>Patient_Id</th>
<th>Patient_Name</th>
<th>Age</th>
<th>Gender</th>
<th>Contact_Details</th>
<th>Medical_History</th>
<th>Investigations_Done</th>
<th>Diagnosis</th>
</tr>
</thead>
<tbody>
<?php
$host='localhost';
$dbusername='root';
$dbpassword='';
$dbname='patient_handbook_dev';
$conn = mysqli_connect($host,$dbusername,$dbpassword, $dbname);
if($conn->connect_error)
{
die('Connection Failed :'.$conn->connect_error);
}
else
{
$query = "SELECT * from Details";
$result = mysqli_query($conn,$query);
while ($res = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>".$res['Date']."</td>";
echo "<td>".$res['Patient_Id']."</td>";
echo "<td>".$res['Patient_Name']."</td>";
echo "<td>".$res['Age']."</td>";
echo "<td>".$res['Gender']."</td>";
echo "<td>".$res['Contact_Details']."</td>";
echo "<td>".$res['Medical_History']."</td>";
echo "<td>".$res['Investigations_Done']."</td>";
echo "<td>".$res['Diagnosis']."</td>";
echo "</tr>";
}
}
?>
</script>
</tbody>
</table>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('#donations').DataTable();
});
var donations = $('#donations').DataTable();
$('#donations').on( 'click', 'tbody tr', function () {
donations.row( this ).delete();
} );
var donations1 = $('#donations').DataTable();
$('#donations').on( 'click', 'tbody tr', function () {
donations1.row( this ).delete( {
buttons: [
{ label: 'Cancel', fn: function () { this.close(); } },
'Delete'
]
} );
} );
</script>
</body>
</html>