Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshugarg36 committed Oct 5, 2019
1 parent b0110fe commit 285b992
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 43 deletions.
24 changes: 0 additions & 24 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,3 @@ function setLive($paperId, $start, $end, $date)
}
checkQuery($exe, 'Exam Set Live');
}
function getPaperStyle($url)
{
global $conn;
$qry = "SELECT * FROM onair WHERE url='$url'";
$exe = mysqli_query($conn, $qry);
$array = array(array());
$i = 0;
while ($cont = mysqli_fetch_array($exe)) {
for ($j = 0; $j <= 5; $j++) {
$array[$i][$j] = $cont[$j];
}
$i++;
}
$qry = "SELECT * FROM questions WHERE paper_id='$array[0][1]'";
$exe = mysqli_query($conn, $qry);
$questions = array(array());
$i = 0;
while ($cont = mysqli_fetch_array($exe)) {
for ($j = 0; $j <= 5; $j++) {
$questions[$i][$j] = $cont[$j];
}
$i++;
}
}
88 changes: 69 additions & 19 deletions view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
<?php
include "config.php";
global $conn;
$qry = "SELECT * FROM onair WHERE url='" . $_GET['onairID'] . "'";
$exe = mysqli_query($conn, $qry);
$onairData = array(array());
$i = 0;
while ($cont = mysqli_fetch_array($exe)) {
for ($j = 0; $j <= 5; $j++) {
$onairData[$i][$j] = $cont[$j];
}
$i++;
}

$qry = "SELECT * FROM questions WHERE paper_id='" . $onairData[0][1] . "'";
$exe = mysqli_query($conn, $qry);
$questions = array(array());
$i = 0;
while ($cont = mysqli_fetch_array($exe)) {
for ($j = 0; $j <= 3; $j++) {
$questions[$i][$j] = $cont[$j];
}
$i++;
}

$qry = "SELECT * FROM paper WHERE paper_id='" . $onairData[0][1] . "'";
$exe = mysqli_query($conn, $qry);
$paperData = array(array());
$i = 0;
while ($cont = mysqli_fetch_array($exe)) {
for ($j = 0; $j <= 5; $j++) {
$paperData[$i][$j] = $cont[$j];
}
$i++;
}

$qry = "SELECT * FROM subjects WHERE code='" . $paperData[0][1] . "'";
$exe = mysqli_query($conn, $qry);
$subjects = array(array());
$i = 0;
while ($cont = mysqli_fetch_array($exe)) {
for ($j = 0; $j <= 4; $j++) {
$subjects[$i][$j] = $cont[$j];
}
$i++;
}
?>
<style>
body {
Expand All @@ -20,19 +64,13 @@
justify-content: space-between;
}
</style>

<?php
$data = getPaperStyle($_GET['onairID']);
print_r($data);
?>

<div class="paper-parent">
<h1 class="center">Exam Name</h1>
<h3 class="center">Subject Code</h3>
<h3 class="center">Computer</h3>
<h1 class="center"><?php echo getSubjectName($paperData[0][1]) ?></h1>
<h3 class="center">Subject Code:<?php echo $paperData[0][1] ?></h3>
<h3 class="center" style="text-transform:uppercase;"><?php echo $subjects[0][4] ?></h3>
<h3 class="flex-between">
<span class="left">Time Duration: 3 Hours</span>
<span class="right">Max. Marks: 60</span>
<span class="right">Max. Marks: <?php echo $paperData[0][3] ?></span>
</h3>
<h5>INSTRUCTION TO CANDIDATES :</h5>
<ul>
Expand All @@ -43,25 +81,37 @@
<div>
<h3 class="center">Section A</h3>
<ol>
<li></li>
<li></li>
<li></li>
<?php
foreach ($questions as $question) {
if ($question[3] == "A") {
echo "<li>$question[2]</li>";
}
}
?>
</ol>
</div>
<div>
<h3 class="center">Section B</h3>
<ol>
<li></li>
<li></li>
<li></li>
<?php
foreach ($questions as $question) {
if ($question[3] == "B") {
echo "<li>$question[2]</li>";
}
}
?>
</ol>
</div>
<div>
<h3 class="center">Section C</h3>
<ol>
<li></li>
<li></li>
<li></li>
<?php
foreach ($questions as $question) {
if ($question[3] == "C") {
echo "<li>$question[2]</li>";
}
}
?>
</ol>
</div>
</div>

0 comments on commit 285b992

Please sign in to comment.