-1
我想顯示我的表中的每一行數據到高圖,我如何顯示使用PHP到JavaScript foreach行的數據?從php表中獲取數據高圖
<script>
series: [{
name: 'Mie Instan',
data: [<?php foreach ($query as $row){echo $row['mie'];}]
}, {
name: 'Beras',
data: [<?php foreach ($query as $row){echo $row['beras'];}]
}, {
name: 'Telur',
data: [<?php foreach ($query as $row){echo $row['telur'];}]
}]
</script>
只是在PHP中首先構建完整的數據,然後最後在結構完成時使用'echo json_encode()' – Ghost