Im sorry, I really dont get this > the returned (reversedarray) > is lost in the null land, because no variable is defined to receive > id!
If $id = 0 I dont need it to be added to the array - the array is now complete so I want to take the array ive built to date and exit the function > And the $arraywill just contain the values as before the call > (recursive) to thefunction. Thats just what I want > And furthermore, I don't see any statement returning anything from > hereon! Shouldn't return $reverse; be enough to return my array? On Jun 29, 9:04 pm, John Andersen <[email protected]> wrote: > Assuming you are passing anarraywith one ID, then if I understand > your problem correctly, a parent will be read from the database and as > it will not be 0, thefunctionwill enter the else statement. > > There is will add the parent ID to thearrayand then pass thisarray > plus the parent ID via a recursive call to thefunction. > > In the (recursive)functiona parent will be read and it will be 0, > thus entering into the main if statement, where thearrayis reversed, > and returned ... > > ... returning to thefunction... ups, the returned (reversedarray) > is lost in the null land, because no variable is defined to receive > id! And the $arraywill just contain the values as before the call > (recursive) to thefunction. > > And furthermore, I don't see any statement returning anything from > hereon! > > Please check your code !! Turn on Debug, add debug statements and try > again! > Enjoy, > John > > On Jun 28, 11:53 pm, Sanfly <[email protected]> wrote: > > > No, I dont think so. I have no trouble building thearraybecause > > this line: > > > print_r($reverse); echo "<br><br>"; > > > does print the entire correctarray. Its returning it from the > >functionwhen there is more than one value in thearraythat gives me > > a problem. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
