Your IP : 216.73.216.40


Current Path : /var/www/html/venkat/aviral/aviral/
Upload File :
Current File : /var/www/html/venkat/aviral/aviral/view.php

<?php
include('db1.php');
include('session.php');
$_backButton = '<div class="container"><form action="home.php"><button type="submit">Go Back</button></form></div>';
?>
<head>
	<link rel="stylesheet" href="styles.css">
</head>
<center>
<h2>Registered Courses</h2>
<!-- <table style="border:1px solid black;border-collapse:collapse;"> -->
<table>
	<tr >
		<th>Course_Code</th>
		<th>Course_Name</th>
		<th>Semester</th>
		<th>L</th>
		<th>T</th>
		<th>P</th>
	</tr>
<?php
$id = addslashes($_SESSION['key']);
$q = $conn->prepare("select course_id from aviral_registered where student_id = :id");
$q->bindParam(':id', $id);
$q->execute();
$res = $q->fetchAll(PDO::FETCH_ASSOC);
// print_r($res);

foreach ($res as $row) {
	$courseid = $row['course_id'];
//		echo '3';
	$qi = $conn->prepare("select * from aviral_courses where id = :courseid");
	$qi->bindParam(':courseid', $courseid);
	$qi->execute();

	$course = $qi->fetch(PDO::FETCH_ASSOC);
//		echo '2';
	
	if (!$course) {
		echo 'ERR: Course id ' . $courseid . ' not found. Please report this to the developer.';
		die();
	} else {
		$course_code = $course['course_code'];
		$course_name = $course['course_name'];
		$semester = $course['semester'];
		$L = $course['L'];
		$T = $course['T'];
		$P = $course['P'];
		echo '<tr>';
		echo '<td>' . $courseid . '</td>';
		echo '<td>' . $course_name . '</td>';
		echo '<td>' . $semester . '</td>';
		echo '<td>' . $L . '</td>';
		echo '<td>' . $T . '</td>';
		echo '<td>' . $P . '</td>';
		echo '</tr>';
	}
}
?>
</table>
<?php echo $_backButton; ?>