0
我只想知道如何在這裏添加數據類型?谷歌圖表需要數據類型時,我使用此代碼:使用PHP和MySQL的Google圖表的數據類型
我從谷歌圖表得到一個錯誤,它的數據類型需要定義...請幫助。謝謝!
while($r = mysql_fetch_assoc($query)) {
$google_JSON = "{cols: [";
$column = array_keys($r);
foreach($column as $key=>$value){
$google_JSON_cols[]="{id: '".$key."', label: '".$value."'}";
}
$google_JSON .= implode(",",$google_JSON_cols)."],rows: [";
$google_JSON_rows[] = "{c:[{v: '".$r['id']."'}, {v: ".$r['count']."}]}";
}
// you may need to change the above into a function that loops through rows, with $r['id'] etc, referring to the fields you want to inject..
//pass it into google charts data
echo $google_JSON.implode(",",$google_JSON_rows)."]}";
感謝Man,好吧..我會嘗試在PHP中進行編碼,即時消息在使用Perl中不是很好...實際上我不熟悉它。 – 2012-03-01 01:08:56