小编use*_*184的帖子

array_push只返回推入的最后一个元素?

$ 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)

php php-5.3

0
推荐指数
1
解决办法
168
查看次数

标签 统计

php ×1

php-5.3 ×1