1 回答
TA贡献1830条经验 获得超3个赞
我发现了问题所在。由于我没有将 $new_data 设置为数组,因此 $dataPoints 无法找到要显示的数组 ID。在这里我如何修复它
<?php
$sql = "SELECT count(order_id) as counti, order_date FROM order_detail GROUP BY order_date ORDER BY order_date DESC";
$result = mysqli_query($conn, $sql);
$dataPoints = array();
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$new_data = array("label"=> $row['order_date'], "y"=> $row['counti']);
$dataPoints = array_merge($dataPoints, array($new_data));
print_r($dataPoints);
};
}
else
{
echo '<script>alert("Unable to load GraphModel");</script>';
}
?>
- 1 回答
- 0 关注
- 162 浏览
添加回答
举报