function verify_children($parent, $cid) { global $CONFIG, $children; $sql = "SELECT cid FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = {$parent}"; $result = cpg_db_query($sql); if (($cat_count = $result->numRows()) > 0) { while ($row = $result->fetchAssoc()) { $children[] = $row['cid']; verify_children($row['cid'], $cid); } } $result->free(); return false; }
function verify_children($parent, $cid) { global $CONFIG, $children; $sql = "SELECT cid " . "FROM {$CONFIG['TABLE_CATEGORIES']} " . "WHERE parent = '{$parent}' "; $result = cpg_db_query($sql); if (($cat_count = mysql_num_rows($result)) > 0) { while ($row = mysql_fetch_array($result)) { $children[] = $row['cid']; // call this function again to this this // child's children verify_children($row['cid'], $cid); } } return false; }