You are on page 1of 4

206150307007 DCE-A SUHANI VAISHNAV

PRACTICAL – 27
AIM: Write a program to read data from table and display all these
information in tabular form on output screen. Eg. GTU Result.

INPUT:-
<html>
<head>
<title>gtu result</title>
<style>
form{
border: 2px dotted black;
height:40%;
width:30%;
padding:15px;
font-size:20px;
}
table{
width:800px;
}
.d1 table tr{
font-size:35px;
padding:20px;
color: #000080;
font-style:sans-serif;
}
.d2 table tr th{
text-align:justify;
padding:5px;
background-color:#EBF5FB;
}
.d3 table{
3350702 DWPD Page | 140
206150307007 DCE-A SUHANI VAISHNAV

border-color:lightgrey;
}
.d3 table tr{
background-color:#CDCCDD;
}
.d5 table{
width:900px;
}
h3{
color:red;
}
h2{
color:green;
}
</style>
</head>
<body>
<center>
<div class="d1">
<table>
<tr>
<td><img src="logo.png" width="120px"
height="100px"></td>
<td><b>Gujarat Technological University
Ahmedabad</b></td>
</tr>
</table>
</div>
<hr width="800px" color="grey">
<div class="main_table">
<tr bgcolor="#E6E4E4">
<table border=1>
<tr>
3350702 DWPD Page | 141
206150307007 DCE-A SUHANI VAISHNAV

<th>SUBJECT CODE</th>
<th>SUBJECT NAME</th>
<th>MARKS</th>
<th>GRADE</th>
</tr>
<?php
$con=mysqli_connect("localhost","root");
mysqli_select_db($con,"GTU");
$sql="select * from GTU";
$result=mysqli_query($con,$sql);
while($row=mysqli_fetch_array($result))
{
$Code=$row['SUBJECT CODE'];
$Name=$row['SUBJECT NAME'];
$Marks=$row['MARKS'];
$Grade=$row['GRADE'];
?>
<tr>
<th><?php echo $Code; ?></th>
<th><?php echo $Name; ?></th>
<th><?php echo $Marks; ?></th>
<th><?php echo $Grade; ?></th>
</tr>
<?php
}
$records=mysqli_num_rows($result);
?>
<tr>
<th><?php echo $records."Records"; ?></th>
</tr>
<?php
mysqli_close($con);
?>
3350702 DWPD Page | 142
206150307007 DCE-A SUHANI VAISHNAV

</table>
<table border="1px" width="50%" style="margin-top: 10px">
<tr><td>Current Sem.Backlog:<b>0</b></td>
<td>Total Backlog:<b>0</b></td>
<td>Total:<b>709</b></td>
<td>SPI :<b>9.50</b></td>
<td>CPI :<b>9.57</b></td>
<td>CGPA :<b>9.32</b></td>
</tr>
</table>
<br>
<?php
{
echo "<h2>Congratulations!! You Have Pass This
Exam...</h2>";
}
?>
<html>

3350702 DWPD Page | 143

You might also like