<?php
$arr= array();
include("connect_db.php");
$sql_fetch_zill= "SELECT * FROM varnans WHERE status='active'";
$res= mysqli_query($con,$sql_fetch_zill);
if($res){
    if(mysqli_num_rows($res)>0){
        $data['status']= "success";
        array_push($arr,$data);
        while($rows= mysqli_fetch_row($res)){
            $data['id']=$rows[0];
            $data['name']=$rows[1];
            $data['status']=$rows[2];
            $data['row_id']=$rows[3];
            $data['created_at']=$rows[4];
            $data['updated_at']=$rows[5];
            array_push($arr,$data);
        }
    }
    else{
        $data['status']="fail";
        $data['message']="No data found";
        array_push($arr,$data);
    }
}
else{
    $data['status']="fail";
    $data['message']=mysqli_error($con);
    array_push($arr,$data);
}
echo json_encode($arr);
?>