access variables from other function within same class? |
[eluser]Kristof[/eluser]
Code: class M_airports extends model { I need the $ID in the addAirportpics function but i don't know how to get to it. Could someone please help me out with this? Thanks in advance
[eluser]pistolPete[/eluser]
You need to use a class variable: Code: class M_airports extends model {
[eluser]kurucu[/eluser]
That's a bit messy though, as depending on when addAirportpics is called, all sorts of funny behaviour could result. Perhaps return $ID from addAirport, and then pass it back into addAirportpics as a function variable. This makes the function more portable, and also you can do some error checking in the controlling function before calling it.
[eluser]mehwish[/eluser]
I have the same issue and I tried the way you mentioned but Code: echo $this->id
|
Welcome Guest, Not a member yet? Register Sign In |