<?php $sql="SELECT Ywyuan,count(Ddhao) as amount from main where format(Djshjian,'m')='$months' group by Ywyuan "; $rs=$db->Query($sql); while($data=$rs->FetchRow()){ $mycard_arr[] = $data; } if(!empty($mycard_arr)){ $xmlStr="<chart caption='当月客户下单记录总数统计' xAxisName='业务员' yAxisName='数量' showValues='1' formatNumberScale='0' showBorder='1' AlternateHGridColor='ff5904' divLineColor='ff5904' divLineAlpha='30' alternateHGridAlpha='5' canvasBorderColor='666666' baseFontColor='666666' lineColor='FF8000' baseFontSize='11'>"; foreach($mycard_arr as $value){ //这里不知道为什么 $value['Ywyuan'] 和 $value['amount']取不到值 echo "业务员".var_dump($value['Ywyuan']); echo "<br>"; // echo "数字".var_dump($value['amount']); // echo "<br>"; // $value['Ywyuan']='张静'; // $value['amount']=800; $xmlStr.="<set label='".$value['Ywyuan']."' value='".$value['amount']."' />"; } $xmlStr.="</chart>"; echo renderChartHTML("./../lib07/FusionCharts/Line.swf","",$xmlStr,"myFirst", 900, 400, false,false); echo "<br>"; } ?>
$mycard_arr array salah, semak bagaimana format tatasusunan anda
Nilai boleh dipanggil keluar dalam pernyataan
, tetapi nilai itu akan kosong sebaik sahaja memasuki foreach.