$result = mysql_query("SELECT Country, Quantity FROM `table 1`");
$rows = array();
while($r = mysql_fetch_array($result)) {
$row[0] = $r[0];
$row[1] = $r[1];
array_push($rows,$row);
}
print json_encode($rows, JSON_NUMERIC_CHECK);
How can I fetch a data while calculating it at first? I need to add below code to the above code and display in graph.
while($row = mysql_fetch_array($result1)){
echo "Total Quantity = ". $row['SUM(quantity)'];
echo "<br />";