我有这样的表,表1:结果值 - MySQL的
+----+-------+----------+
| ID | MONTH | QUANTITY |
+----+-------------+----+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 7 | 3 |
| 4 | 4 | 1 |
| 5 | 2 | 3 |
| 6 | 12 | 8 |
| 7 | 1 | 6 |
+----+-------+----------+
My file php is:
<?php
include 'bd_cnx.php';
$ret =[];
$sql = "SELECT
FROM
";
$result = $conn->query($sql);
if ($result->num_rows > 0){
while($row = $result->fetch_assoc()){
//floatval() transforma sirul numeric in numar
$ret[] =[$row['MONTH'], floatval($row['QUANTITY'])];
}
}
else {
echo "result 0";
}
?>
我怎样才能返回值,以这种形式? [[1,7],[2,5],[3,0],[4,1],[5,0],[6,0],[7,3],[8,0],[ 9,0],[10,0],[11,0],[12,8]]
谢谢!
该输出的逻辑是什么? – jophab
_如何返回这种形式的值?_这个_form_背后的规则是什么? –
我需要此表格作为图表行http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ – ster