<?php
$servername = "localhost";
$username = "Restax_final";
$password = "Restax_final123";
$dbname = "Restax_api_data";

// Create connection
$con = new mysqli($servername, $username, $password, $dbname);

$id = $request->getAttribute('id');

 
 if(isset($id)){
$sql="SELECT seated_students.punch_in,seated_students.recover_code,seated_students.student_roll,seated_students.papers_shortcode,Exams.examname FROM seated_students INNER JOIN Exams  ON Exams.id = seated_students.exams_id WHERE seated_students.id='$id'";
}

$result = $con->query($sql);
if($result->num_rows>0)
{
  // while ($row=mysqli_fetch_assoc($result)) 
  while($row = $result->fetch_assoc())
{   
  $users=$row;

    $users["student_roll"] = json_decode($row["student_roll"]);
    $users["papers_shortcode"] = json_decode($row["papers_shortcode"]);
     
}

$used_array[] = $users;
echo json_encode($used_array);


}