-
Notifications
You must be signed in to change notification settings - Fork 0
/
doctors.php
115 lines (101 loc) · 5.29 KB
/
doctors.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
include 'admin/db_connect.php';
$special = $conn->query("SELECT * FROM medical_specialty");
$ms_arr = array();
while ($row = $special->fetch_assoc()) {
$ms_arr[$row['id']] = $row['name'];
}
?>
<header class="masthead">
<div class="container h-100">
<div class="row h-100 align-items-center justify-content-center text-center">
<div class="col-lg-10 align-self-end mb-4 page-title">
<h3 class="text-white">Book an appointment with our doctors</h3>
<hr class="divider my-4" />
</div>
</div>
</div>
</header>
<section class="page-section" id="doctors" >
<div class="container">
<div class="card">
<div class="card-body">
<div class="col-lg-12">
<?php if (isset($_GET['sid']) && $_GET['sid'] > 0): ?>
<div class="row">
<div class="col-md-12 text-center">
<?php
$s = $conn->query("SELECT * from medical_specialty where id = " . $_GET['sid'])->fetch_array()['name'];
?>
</div>
</div>
<hr class="divider">
<?php endif; ?>
<?php
$where = "";
// The SQL LIKE Operator
//The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
//
//There are two wildcards often used in conjunction with the LIKE operator:
//
// The percent sign (%) represents zero, one, or multiple characters
// The underscore sign (_) represents one, single character
if (isset($_GET['sid']) && $_GET['sid'] > 0) { // any where less than 1 means failed to get data
//The REPLACE() function replaces all occurrences of a substring within a string, with a new substring.
$where = " WHERE (REPLACE(specialty_ids , ',' , '\" ,\" '), '[' , '[\"' ), ']' ,'\" ]') ) "
. " LIKE '%\" " .
$_GET['sid'] . "\"%' ";
}
$cats = $conn->query("SELECT * FROM doctors_list " . $where . " order by id asc");
while ($row = $cats->fetch_assoc()):
?>
<div class="row align-items-center">
<div class="col-md-3">
<img src="assets/img/<?php echo $row['img_path'] ?>" alt="">
</div>
<div class="col-md-6">
<p>Name: <b><?php echo "Dr. " . $row['name'] . ', ' . $row['name_pref'] ?></b></p>
<p><small>Email: <b><?php echo $row['email'] ?></b></small></p>
<p><small>Clinic Address: <b><?php echo $row['clinic_address'] ?></b></small></p>
<p><small>Contact Number: <b><?php echo $row['contact'] ?></b></small></p>
<p><small><a href="javascript:void(0)" class="view_schedule" data-id="<?php echo $row['id'] ?>" data-name="<?php echo "Dr. " . $row['name'] . ', ' . $row['name_pref'] ?>"><i class='fa fa-calendar'></i> Schedule</a></b></small></p>
<p><b>Specialties:</b></p>
<div>
<?php if (!empty($row['specialty_ids'])): ?>
<?php
foreach (explode(",", str_replace(array("[", "]"), "", $row['specialty_ids'])) as $k => $val):
?>
<span class="badge badge-light" style="padding: 10px"><large><b><?php echo $ms_arr[$val] ?></b></large></span>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<div class="col-md-3 text-center align-self-end-sm">
<button class="btn-outline-primary btn mb-4 set_appointment" type="button" data-id="<?php echo $row['id'] ?>" data-name="<?php echo "Dr. " . $row['name'] . ', ' . $row['name_pref'] ?>">Set Appointment</button>
</div>
</div>
<hr class="divider" style="max-width: 60vw">
<?php endwhile; ?>
</div>
</div>
</div>
</div>
</section>
<style>
#doctors img{
max-height: 300px;
max-width: 200px;
}
</style>
<script>
$('.view_schedule').click(function () {
my_modal($(this).attr('data-name') + " - Schedule", "view_doctor_schedule.php?id=" + $(this).attr('data-id'));
});
$('.set_appointment').click(function () {
if ('<?php echo isset($_SESSION['login_id']) ?>' == 1)
my_modal("Set Appointment with " + $(this).attr('data-name'), "set_appointment.php?id=" + $(this).attr('data-id'), 'mid-large');
else {
my_modal("Login First", "login.php");
}
});
</script>