-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
50 lines (42 loc) · 1.52 KB
/
home.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
<?php
include 'config.php';
include 'mainLayout.php';
?>
<h1 class="mt-4">Courses</h1>
<div class="card mb-4">
<div class="card-body">
<table id="datatablesSimple">
<thead>
<tr>
<th>Course id</th>
<th>Course name</th>
<th>College name</th>
</tr>
</thead>
<tbody>
<?php
$query = "select * from courses";
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)){
// select Collge name from college table by college ID
$cQuery = "select name from college where college_id = ". $row['college_id'] ;
$cResult = mysqli_query($conn, $cQuery);
if(mysqli_num_rows($cResult) > 0){
$cRow = mysqli_fetch_assoc($cResult);
}
echo "<tr> <td>". $row['course_id']."</td>
<td>" . $row['name'] . "</td>
<td>" . $cRow['name'] . "</td> </tr>";
}
}else{
$error = 'there exist error';
}
?>
</tbody>
</table>
</div>
</div>
<?php
include 'footer.php';
?>