-
Notifications
You must be signed in to change notification settings - Fork 1
/
view_bed.php
43 lines (40 loc) · 1.51 KB
/
view_bed.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
<?php
echo '<div class="d-none">'; #Bootstrap 'd-none' as mysql_connect is an old syntax.
$conn=mysql_connect('localhost','root',''); #for wampserver/xampserver user
$db=mysql_select_db('dbms_pr');
echo '</div>';
#---------------------------- STUDENT,BED : Display student details who occupies beds currently. ----------------------------------------------
$qry="SELECT STUDENT.NAME,BED.ROLL,STUDENT.BRANCH,STUDENT.`phone_number`,BED.S_NO,BED.IN_DATE FROM BED,STUDENT WHERE STUDENT.ROLL=BED.ROLL AND BED.VACANCY=0 ";
$result=mysql_query($qry);
$num=mysql_num_rows($result);
echo '<div class="mt-lg-5 row row-content justify-content-center">
<div >
<div class="table-responsive">
<table class="table table-striped" style="display:block;" height="400">
<thead class="thead-dark">
<tr>
<th>Name</th>
<th> <center>Roll </center></th>
<th><center> Branch </center></th>
<th><center> Phone number </center></th>
<th> <center>Bed no. </center></th>
<th><center> Date </center></th>
</tr>
</thead>
';
if($num>0){
while($row=mysql_fetch_assoc($result)){
echo '<tr>
<td >'.$row['NAME'].'</td>
<td >'.$row['ROLL'].'</td>
<td >'.$row['BRANCH'].'</td>
<td >'.$row['phone_number'].'</td>
<td ><center>'.'B0'.$row['S_NO'].'</center></td>
<td >'.$row['IN_DATE'].'</td>
</tr>';
}
echo "</table></div></div></div>";
}
#when given roll number does not match any roll number in the database.
else echo"NO BED IS ALLOTED YET<br>";
?>