Re:
| From: | Martin Rozmus | Date: | Sun, 10 Oct 2004 09:50:35 +0000 |
| Subject: | Re: | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199098@lists.php.net to get a copy of this message | ||
Am Samstag, den 09.10.2004, 21:29 -0500 schrieb php-
list@xenonsolutions.com:
> Hello everyone,
>
> I'm hoping you guys can help me with this error. Here's what I'm getting:
>
> Notice: Undefined variable: children in
> L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
> 58
[...]
>
> function get_children($parent) {
> $parent_coord = tree::get_item_coord($parent);
> $descendants = $this->get_descendants($parent);
> for ($i = 0; $i < count($descendants); $i++) {
> if ((empty($children)) && (($parent_coord['0']['lft'] +
> 1) ==
> $descendants[$i]['lft'])) {
> $children[] = $descendants[$i]; // found first child
> }
> elseif (($children[count($children)-1]['rgt'] + 1 ==
> $descendants[$i]['lft']) && $children[count($children)-1]['rgt'] +
> 1 !=
> $parent_coord['0']['rgt']) {
> $children[] = $descendants[$i]; // find next children
> }
> }
> return $children;
> }
>
Where is the line 58 in the code above? It seems as you use a not
'declared ' variable. You should check variables for existance with the
isset() function before using them.
--
Martin Rozmus <martin.rozmus@gmx.net>