Results

 

[insert_php]
if( isset($_POST[‘submit_result’]) )
{
if (!((strlen($_POST[‘USN’])==10)||(strlen($_POST[‘USN’])==12)||(strlen($_POST[‘USN’])==13)))
{
echo “Please enter a valid USN\n”;
echo ”

\”Go

“;
exit;
}

$USN = htmlentities($_POST[‘USN’]);
//These variable values come from the hosting account.
$dbname = “epiz_21316655_w686”;

$conn=mysql_connect(“localhost”, “epiz_21316655”, “chethan@sjce”) OR DIE (“Unable to connect to database! Please try again later.”);

mysql_select_db($dbname) or die(mysql_error());
$query = “SELECT * FROM wp_results WHERE USN LIKE ‘%” . $USN . “%'”;
$result = mysql_query($query);

$row = NULL;
if($row = mysql_fetch_array($result));
else
{
echo “Invalid USN / No result found. \n Check back later.\n”;
echo ”

\”Go

“;
exit;
}

echo ”

Name : “, $row[Name], ”

\n”, ”

USN : “, $row[USN], ”

“;

echo ”

“; echo “”;
/*
foreach($row as $col => $value)
{
if($col==”USN” || $col == “Name”)
continue;
echo “”;
echo $col;
echo “”;
}
*/
echo “”;
SUBCODE SUBNAME GRADE
mysql_data_seek($result, 0);
while($row = mysql_fetch_array($result))
{
echo ”
{$row[‘SUBCODE’]}

\t{$row[‘SUBNAME’]}

\t{$row[‘Grade’]}

\t

“;
}
mysql_close($conn);
echo ”

“;

echo ”
“;
echo “\n \n
Grades:
S = Outstanding (90-100)
A = Excellent (75-89)
B = Very Good (66-74)
C = Good (56-65)
D = Average (50-55)
E = Poor (45-49)
F = Fail (<45) PP = Passed (>=50%)
NP = Not Passed (<50%)
I, W, X = Transitional Grades
MP = Malpractice
AB = Absent
NE = Not Eligible
NR = Not Registered
DR = Drop “;

}
[/insert_php]