-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathids.php
More file actions
46 lines (39 loc) · 1.17 KB
/
ids.php
File metadata and controls
46 lines (39 loc) · 1.17 KB
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
<?php
/*$key=$_GET['key'];
$array = array();
$patients = new Patient;
$patient_ids = $patients->getPatients($key);
while($patient_ids) {
$array[] = $patient_ids['patient_id'];
}
echo json_encode($array);
if(isset($_POST["query"])) {
$patients = new Patient;
$patient_ids = $patients->getPatients($_POST["query"]);
$output = '';
$output = '<ul class="list-unstyled">';
if(mysqli_num_rows($patient_ids) > 0)
{
while($patient_ids)
{
$output .= '<li>'.$patient_ids['patient_id'].'</li>';
}
}
else
{
$output .= '<li>Patient Not Found</li>';
}
$output .= '</ul>';
echo $output;
} */
$key=$_GET['key'];
$array = array();
$con=mysqli_connect("localhost","root","","hms");
$query=mysqli_query($con, "select * from patient where patient_id LIKE '%{$key}%'");
while($row=mysqli_fetch_assoc($query))
{
$array[] = $row['patient_id'];
}
echo json_encode($array);
mysqli_close($con);
?>