-
Notifications
You must be signed in to change notification settings - Fork 1
/
search_university.php
283 lines (260 loc) · 14 KB
/
search_university.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?php
include "header.php";
include "navigation.php";
require_once 'connection.php';
?>
<div class="container-fluid">
<?php
$id = $_GET['id'];
$sql = "SELECT * FROM search_list WHERE list_id='$id' ";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
//print_r($result);
$list_id = $result['list_id'];
$user_id = $result['user_id'];
$inter_subject = $result['inter_subject'];
$inter_percentage = $result['inter_percentage'];
$interested_program = $result['interested_program'];
$fee_start = $result['fee_start'];
$fee_end = $result['fee_end'];
$admission_date = $result['admission_date'];
$season = $result['season'];
$filter_sql = "SELECT
program_university.university_id,
program_university.program_id,
program_university.duration,
program_university.merit,
program_university.fee,
program_university.best_for,
program_university.program_link,
program_university.details,
programs.program_id,
programs.program_name,
universities.university_id,
universities.university_name,
universities.founded,
universities.website,
universities.phone,
universities.location,
universities.campus,
universities.hours,
universities.details,
universities.image,
universities.created_at
FROM program_university
INNER JOIN programs ON program_university.program_id = programs.program_id
INNER JOIN universities ON program_university.university_id = universities.university_id
WHERE program_university.best_for LIKE '%$inter_subject%'
AND program_university.fee BETWEEN '$fee_start' AND '$fee_end'
AND program_university.merit <= '$inter_percentage' ";
$filter_stmt = $conn->prepare($filter_sql);
$filter_stmt->execute();
if ($filter_stmt->rowCount() == 0) {
echo '<div class="jumbotron mt-4 h3">No University Found according to your list.</div>';
}
while ($filter_result = $filter_stmt->fetch(PDO::FETCH_ASSOC)) { ?>
<div class="jumbotron p-4 mt-1">
<div class="row">
<div class="col-3">
<center>
<?php echo "<img class='img img-fluid' src='images/".$filter_result['image']."'>"; ?>
<br>
<br>
<h4><?php echo $filter_result['university_name'] ?></h4>
<hr>
<p class="text-center mt-1">
<?php echo $filter_result['details'] ?>
</p>
</center>
</div>
<div class="col-9">
<h2 class="text-dark font-weight-bold"><?php echo $filter_result['university_name'] ?></h2>
<div class="p-2 bg-light">
<h5>Details</h5>
<table class="table table-sm table-bordered">
<tr>
<td>Founded</td>
<td>Website</td>
<td>Phone</td>
<td>Location</td>
<td>Campus</td>
<td>Hours</td>
</tr>
<tr>
<td><?php echo $filter_result['founded'] ?></td>
<td><?php echo $filter_result['website'] ?></td>
<td><?php echo $filter_result['phone'] ?></td>
<td><?php echo $filter_result['location'] ?></td>
<td><?php echo $filter_result['campus'] ?></td>
<td><?php echo $filter_result['hours'] ?></td>
</tr>
</table>
</div>
<div class="p-2 bg-light mt-1">
<h5>Programs Details</h5>
<table class="table table-sm table-bordered">
<tr>
<td>Program Name</td>
<td>Duration</td>
<td>Fee</td>
<td>Details</td>
<td>Apply</td>
</tr>
<tr>
<td><?php echo $filter_result['program_name'] ?></td>
<td><?php echo $filter_result['duration'] ?></td>
<td><?php echo $filter_result['fee'] ?></td>
<td><?php echo $filter_result['details'] ?></td>
<td><a href="<?php echo $filter_result['program_link'] ?>" target="_blank" class="btn btn-dark btn-sm">Apply for this program.</a></td>
</tr>
</table>
</div>
<div class="p-2 bg-light mt-1">
<h5>Universities and admissions details</h5>
<table class="table table-sm table-bordered">
<tr>
<td>Season</td>
<td>Start Date</td>
<td>End Date</td>
<td>Details</td>
</tr>
<?php
$university_id = $filter_result['university_id'];
$uni_admission_sql = "SELECT * FROM admission_details WHERE university_id='$university_id' ";
$uni_admission_stmt = $conn->prepare($uni_admission_sql);
$uni_admission_stmt->execute();
if ($uni_admission_stmt->rowCount() > 0) {
while ($uni_admission_result = $uni_admission_stmt->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $uni_admission_result['season'] ?></td>
<td><?php echo $uni_admission_result['start_date'] ?></td>
<td><?php echo $uni_admission_result['end_date'] ?></td>
<td><?php echo $uni_admission_result['details'] ?></td>
</tr>
<?php
} //while
} else {
echo '<tr><td>Data not found</td></tr>';
} ?>
</table>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<?php exit; ?>
<div class="container-fluid">
<?php
$id = $_GET['id'];
$university_sql = "SELECT * FROM universities WHERE university_id='1' ";
$university_stmt = $conn->prepare($university_sql);
$university_stmt->execute();
while ($university_result = $university_stmt->fetch(PDO::FETCH_ASSOC)) { ?>
<div class="jumbotron p-4 mt-1">
<div class="row">
<div class="col-3">
<center>
<?php echo "<img class='img img-fluid' src='images/".$university_result['image']."'>"; ?>
<br>
<br>
<h4><?php echo $university_result['university_name'] ?></h4>
<hr>
<p class="text-center mt-1">
<?php echo $university_result['details'] ?>
</p>
</center>
</div>
<div class="col-9">
<h2 class="text-dark font-weight-bold"><?php echo $university_result['university_name'] ?></h2>
<div class="p-2 bg-light">
<h5>Details</h5>
<table class="table table-sm table-bordered">
<tr>
<td>Founded</td>
<td>Website</td>
<td>Phone</td>
<td>Location</td>
<td>Campus</td>
<td>Hours</td>
</tr>
<tr>
<td><?php echo $university_result['founded'] ?></td>
<td><?php echo $university_result['website'] ?></td>
<td><?php echo $university_result['phone'] ?></td>
<td><?php echo $university_result['location'] ?></td>
<td><?php echo $university_result['campus'] ?></td>
<td><?php echo $university_result['hours'] ?></td>
</tr>
</table>
</div>
<div class="p-2 bg-light mt-1">
<h5>Programs Details</h5>
<table class="table table-sm table-bordered">
<tr>
<td>Program Name</td>
<td>Duration</td>
<td>Fee</td>
<td>Details</td>
<td>Apply</td>
</tr>
<?php
$university_id = $university_result['university_id'];
$program_university_sql = "SELECT * FROM program_university WHERE university_id='$university_id' ";
$program_university_stmt = $conn->prepare($program_university_sql);
$program_university_stmt->execute();
while ($program_university_result = $program_university_stmt->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<!-- <td>BSCS</td> -->
<?php
$program_id = $program_university_result['program_id'];
$program_sql = "SELECT * FROM programs WHERE program_id='$program_id' ";
$program_stmt = $conn->prepare($program_sql);
$program_stmt->execute();
$program_result = $program_stmt->fetch(PDO::FETCH_ASSOC);
?>
<td><?php echo $program_result['program_name'] ?></td>
<td><?php echo $program_university_result['duration'] ?></td>
<td><?php echo $program_university_result['fee'] ?></td>
<td><?php echo $program_university_result['details'] ?></td>
<td><a href="<?php echo $program_university_result['program_link'] ?>" target="_blank" class="btn btn-dark btn-sm">Apply for this program.</a></td>
</tr>
<?php } ?>
</table>
</div>
<div class="p-2 bg-light mt-1">
<h5>Universities and admissions details</h5>
<table class="table table-sm table-bordered">
<tr>
<td>Season</td>
<td>Start Date</td>
<td>End Date</td>
<td>Details</td>
</tr>
<?php
$university_id = $university_result['university_id'];
$uni_admission_sql = "SELECT * FROM admission_details WHERE university_id='$university_id' ";
$uni_admission_stmt = $conn->prepare($uni_admission_sql);
$uni_admission_stmt->execute();
if ($uni_admission_stmt->rowCount() > 0) {
while ($uni_admission_result = $uni_admission_stmt->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $uni_admission_result['season'] ?></td>
<td><?php echo $uni_admission_result['start_date'] ?></td>
<td><?php echo $uni_admission_result['end_date'] ?></td>
<td><?php echo $uni_admission_result['details'] ?></td>
</tr>
<?php
} //while
} else {
echo '<tr><td>Data not found</td></tr>';
} ?>
</table>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<?php include "footer.php"; ?>