<?php
    include 'config.php';
	$sth = mysqli_query($con,"SELECT name from hardships order by percentage desc limit 3");
    $rows = array();
    $rows['name'] = 'Hardships';
    while($r = mysqli_fetch_array($sth)) {
     $rows['data'][] = $r['name'];
    }
    $sth = mysqli_query($con,"SELECT percentage from hardships order by percentage desc limit 3");
    $rows1 = array();
    $rows1['name'] = '';
	$rows1['color'] = '#0033a1';
    while($rr = mysqli_fetch_array($sth)) {
     $rows1['data'][] = $rr['percentage'];
    }
	$result = array();
    array_push($result,$rows);
    array_push($result,$rows1);
    print json_encode($result, JSON_NUMERIC_CHECK);
    mysqli_close($con);
    ?>