<?php
include 'config.php';
$sth = mysqli_query($con,"SELECT rdate from returnees order by rdate limit 3");
$rows = array();
$rows['name'] = 'Date';
while($r = mysqli_fetch_array($sth)) {
$rows['data'][] = $r['rdate'];
}
$sth = mysqli_query($con,"SELECT voluntary from returnees order by rdate limit 3");
$rows1 = array();
$rows1['name'] = 'Voluntary';
$rows1['color'] = '#0033a1';
while($rr = mysqli_fetch_array($sth)) {
$rows1['data'][] = $rr['voluntary'];
}
/*$sth = mysqli_query($con,"SELECT involuntary from returnees order by rdate");
$rows2 = array();
$rows2['name'] = 'Involuntary';
$rows2['color'] = '#0033a1';
while($rr = mysqli_fetch_array($sth)) {
$rows2['data'][] = $rr['involuntary'];
}*/
$result = array();
array_push($result,$rows);
array_push($result,$rows1);
//array_push($result,$rows2);
print json_encode($result, JSON_NUMERIC_CHECK);
mysqli_close($con);
?>