我正在创建条形图,我无法获得输出并生成图表。
这是我的代码
if ($sql) {
$arrData = array(
"chart" => array(
"caption" => "Status stastics",
"showValues" => "0",
"theme" => "zune"
)
);
$arrData["data"] = array();
foreach($sql as $row) {
array_push($arrData["data"], array(
"label" => $row["name"],
"value" => $row["value"]
)
var_dump($row["value"]);
);
}
}
我没有得到任何输出(var_dump($ row [" value"]);) 我是以正确的方式去的吗? 任何人都可以帮助我。
答案 0 :(得分:1)
得到了我的答案
if ($sql) {
$arrData = array(
"chart" => array(
"caption" => "Status stastics",
"showValues" => "0",
"theme" => "zune"
)
);
$arrData["data"] = array();
foreach($sql as $row)
{
$object_array =(array)$row;
array_push($arrData["data"], array(
"label" => $object_array["name"],
"value" => $object_array["value"]
)
);
}
}
?>