<?php  include_once('../../config/db.php');  //include_once('../config/check.php'); 






$query = "  SELECT * from sys_roles where status=1    ";




$statement = $conn->prepare($query);

$statement->execute();

$number_filter_row = $statement->rowCount();

$statement = $conn->prepare($query );

$statement->execute();

$result = $statement->fetchAll();

$data = array();



foreach($result as $row)
{
  
 $actionButton = '<input type="radio" name="myradio" class="myradio" value="' . $row["id"] . '" /> </i></a>';
 $sub_array = array();
 $sub_array[] =  $actionButton  ;
 $sub_array[] = $row['date'];
 $sub_array[] = $row['name'];
 $sub_array[] = $row['code'];
 $sub_array[] = $row['description'];
 
 

 $data[] = $sub_array;

}

function count_all_data($conn,$query)
{
 $statement = $conn->prepare($query);
 $statement->execute();
 return $statement->rowCount();
}

$output = array(
                       "draw"       =>  $number_filter_row ,
                        "recordsTotal"   =>  count_all_data($conn,$query),
                        "recordsFiltered"  =>  $number_filter_row,
                        "data"       =>  $data
);

echo json_encode($output);

?>
