PHP sayısı sorunu?

0 Cevap php

Nedense benim $ sayısı daha sonra yani 1, 2 ve birisi bana bu sorunu gidermek yardımcı olabilir gerçekten ben ilk 0'dan başlamalı ve ekran 0 saymak istiyorum ne oluyor bilmiyorum ilk 0 yerine 1 sayısını gösterir?

PHP kodu.

function make_list ($parent = 0, $count = 0, $depth = 0) {
    global $link;

    if($count == 0){
        echo '<ol class="cat-width">';
    } else {
        echo '<ol class="cat-depth">';
    }

    foreach ($parent as $id => $cat) {
        if($cat['parent_id'] == '0'){
            echo '<li><input type="checkbox" name="cat[]" id="cat-' . $cat['id'] . '" value="' . $cat['id'] . '" />
                  <label for="cat-' . $cat['id'] . '" class="label-headers">' . $cat['category'] . '</label>';
        } else {
            $indent = str_repeat('&nbsp; ', $depth * 3);
            echo '<li>' . $indent . '<input type="checkbox" name="cat[]" id="cat-' . $cat['id'] . '" value="' . $cat['id'] . '" />
                  <label for="cat-' . $cat['id'] . '">' . $cat['category'] . '</label>';
        }

        if (isset($link[$id])) {
            make_list($link[$id], $count+1, $depth+1);
        }
            echo '</li>';
    }
        echo '</ol>';
}

$dbc = mysqli_query($mysqli,"SELECT * FROM categories ORDER BY parent_id, category ASC");
if (!$dbc) {
print mysqli_error();
} 

$link = array();

while (list($id, $parent_id, $category, $depth) = mysqli_fetch_array($dbc)) {
$link[$parent_id][$id] =  array('parent_id' => $parent_id, 'id' => $id, 'category' => $category, 'depth' => $depth);
}

make_list($link[0], $depth+1);

0 Cevap