$ orders变量只返回数组的最后一个推送元素,而不是返回所有元素..我确实使用array_push将元素推送到数组$ orders但我只获得推送的最后一个元素...
// Create arrays to populate so that I can iterate over them to display the data on the charts
$views = array();
$orders = array();
if ($pid == 11 && $value > 1631 && $value <= 1635) {
$query = "SELECT label, hits FROM items WHERE item_id='$value' LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
echo "<td>" . $row['label'] . "</td>";
// orders
if ($row['hits'] != 0) {
echo "<td>" . $row['hits'] . "</td>";
}else{
echo "<td>0</td>"; …Run Code Online (Sandbox Code Playgroud)