Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Fetching rows from database

$
0
0

Hello,

 

            I am very new to php programming.Please help me to display the students results from the database.I want to display all the papertitle,marks etc of a particular student.Here is my code

 

 

<?php
include("CommentBox/includes/Connection.php");
$exno=$_GET['examno'];

$query=mysql_query("Select * from results where Examno='$exno'",$con);
if (!$query)
{
die ("Problem in query".mysql_error());
}

while($row=mysql_fetch_array($query))
{
if($row['Examno']==$exno)
{
$Examno=$row['Examno'];
$studname=$row['Name'];
$studrno=$row['Rno'];
$studsem=$row['Sem'];

$papercode=$row['Subcode'];
$papertitle=$row['Title'];
$studcia=$row['CIA'];
$studese=$row['ESE'];
$studcredits=$row['Credits'];
$studgrade=$row['Grade'];
$studgradept=$row['Gradept'];

echo "<table>
<tr>
<td>Name:</td>
<td>".$studname."</td>
</tr>
<tr>
<td>Exam no:</td>
<td>".$Examno."</td>
</tr>
<tr>
<td>Roll No:</td>
<td>".$studrno."</td>
</tr>
<tr>
<td>Semester:</td>
<td>".$studsem."</td>
</tr></table>";
echo "<table>
<tr>
<td>Paper Code</td><td>Title</td><td>CIA</td>
<td>ESE</td><td>Credits</td><td>Grade</td>
<td>Grade Pt</td></tr>";
while($_GET['Examno']==$exno)
{

echo "<tr>
<td>".$papercode."</td><td>".$papertitle."</td><td>".$studcia."</td><td>".$studese."</td><td>".$studcredits."</td><td>".$studgrade."</td><td>".$studgradept."</td></tr>";

}


}
else
{
echo "Invalid Number!";
}
}

?>


Viewing all articles
Browse latest Browse all 13200

Trending Articles