/**
 * @param $pere
 * @param $cpt
 * @return mixed
 */
function compterFils($parent, $cpt)
{
    $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
    $parent = intval($parent);
    $result = Database::query("SELECT code FROM {$tbl_category} WHERE parent_id='{$parent}'");
    while ($row = Database::fetch_array($result)) {
        $cpt = compterFils($row['code'], $cpt);
    }
    return $cpt + 1;
}
Exemplo n.º 2
0
function compterFils($pere, $cpt)
{
    global $tbl_category;
    $pere = Database::escape_string($pere);
    $result = Database::query("SELECT code FROM {$tbl_category} WHERE parent_id='{$pere}'");
    while ($row = Database::fetch_array($result)) {
        $cpt = compterFils($row['code'], $cpt);
    }
    return $cpt + 1;
}