<?php

/*Student API*/

/*Fetching API*/

/* Attempt to connect to MySQL database */
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'restax');

define('DB_PASSWORD', 'restax@123');

define('DB_NAME', 'Restax'); 

$con = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

$course_id = $request->getAttribute('course_id');
$paper_shortcode = $request->getAttribute('paper_shortcode');
$exam_id = $request->getAttribute('exam_id');

if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$response=array();

if(isset($course_id)){

$sql="SELECT * FROM pwe_answersheet_submit WHERE course_id='$course_id' AND exams_id='$exam_id' AND papers_shortcode='$paper_shortcode' AND status='1' OR status='2' ORDER BY id DESC";
$result=mysqli_query($con,$sql);

	
while($row[]=mysqli_fetch_assoc($result)){
    $user=$row;
   
}
echo json_encode($user);


}
?>