<?php
header('Content-Type: application/json');
include 'db/db_connect.php';
$companyfk = $_REQUEST['companyfk'];
$stationid = $_REQUEST['stationid'];
$query = mysqli_query($con, "SELECT * FROM route_tb where stationid='$stationid' And companyfk = '$companyfk'");
$data = array();
$qry_array = array();
$i = 0;
$total = mysqli_num_rows($query);
while ($row = mysqli_fetch_array($query)) {
  $data['routeid'] = $row['routeid'];
  $data['companyfk'] = $row['companyfk'];
  $data['stationid'] = $row['stationid'];
  $data['origin'] = $row['origin'];
  $data['destination'] = $row['destination'];
  $data['fair'] = $row['fair'];
  $qry_array[$i] = $data;
  $i++;
}

if($query){
  $response['success'] = 'true';
  $response['message'] = 'Data Loaded Successfully';
  $response['total'] = $total;
  $response['data'] = $qry_array;
}else{
  $response['success'] = 'false';
  $response['message'] = 'Data Loading Failed';
}

echo json_encode($response);



?>
