-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetDoctors.php
More file actions
31 lines (28 loc) · 994 Bytes
/
getDoctors.php
File metadata and controls
31 lines (28 loc) · 994 Bytes
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
<?php
include 'DatabaseConfig.php';
include 'helper_functions/authentication_functions.php';
//get doctors from the database
$doctors = "SELECT doctors.Id, doctors.name, doctors.image, doctors.description,
doctors.price, doctors.approved,doctors.Merchant_ID as hospital, categories.name as category FROM doctors
join merchant on doctors.Merchant_ID = merchant.Merchant_ID join categories on doctors.category_id = categories.category_id";
$result = mysqli_query($con, $doctors);
if ($result) {
$data = [];
while ($row = mysqli_fetch_assoc($result)) {
$data[] = $row;
}
echo json_encode(
[
'success' => true,
'data' => $data,
'message' => "doctor fetched successfully"
]
);
} else {
echo json_encode(
[
'success' => false,
'message' => 'Error fetching product'
]
);
}