Hi,
I have this function that works...
function _getNoCategorie s($parent){
$sql = 'SELECT id FROM mod_catalogue_c ategory WHERE parent='.$paren t;
$cats = $this->db->get_results($s ql);
foreach($cats as $cat) {
//$r.=$cat->id.',';
$this->excludeCat.=$c at->id.',';
$b=$cat->id;
$this->_getNoCategori es($b);
}
}
But I would like to do it in a more elegant way with a "return" value. I tried it out in several ways but I can“t make them run.
This is an example of what I am trying to.
function _getNoCategorie s($parent,$r){
$sql = 'SELECT id FROM mod_catalogue_c ategory WHERE parent='.$paren t;
$cats = $this->db->get_results($s ql);
foreach($cats as $cat) {
$r.=$cat->id.',';
//$this->excludeCat.=$c at->id.',';
$b=$cat->id;
return $this->_getNoCategori es($b,$r);
}
$return $r;
}
And the function call...
$this->excludeCat =$this->_getNoCategori es(94,'');
Thanks in advance!
I have this function that works...
function _getNoCategorie s($parent){
$sql = 'SELECT id FROM mod_catalogue_c ategory WHERE parent='.$paren t;
$cats = $this->db->get_results($s ql);
foreach($cats as $cat) {
//$r.=$cat->id.',';
$this->excludeCat.=$c at->id.',';
$b=$cat->id;
$this->_getNoCategori es($b);
}
}
But I would like to do it in a more elegant way with a "return" value. I tried it out in several ways but I can“t make them run.
This is an example of what I am trying to.
function _getNoCategorie s($parent,$r){
$sql = 'SELECT id FROM mod_catalogue_c ategory WHERE parent='.$paren t;
$cats = $this->db->get_results($s ql);
foreach($cats as $cat) {
$r.=$cat->id.',';
//$this->excludeCat.=$c at->id.',';
$b=$cat->id;
return $this->_getNoCategori es($b,$r);
}
$return $r;
}
And the function call...
$this->excludeCat =$this->_getNoCategori es(94,'');
Thanks in advance!