![]() |
access variable from different method within same model - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: access variable from different method within same model (/showthread.php?tid=24284) |
access variable from different method within same model - El Forum - 11-05-2009 [eluser]ranjitbd[/eluser] Code: // this is a model class access variable from different method within same model - El Forum - 11-05-2009 [eluser]umefarooq[/eluser] yes you can access with in model class just you have to define variable at class level Code: class Holiday_model extends Model{ access variable from different method within same model - El Forum - 11-05-2009 [eluser]ranjitbd[/eluser] [quote author="umefarooq" date="1257436282"]yes you can access with in model class just you have to define variable at class level Code: class Holiday_model extends Model{ class Holiday_model extends Model{ function get_function(){ public $id; } function get_function2(){ $this->id; // can i use like this. $id is declared public in the get_function method() } } in controller you can access these variables also because these are defined public $this->Holiday_model->id = 1; [/quote] |