Welcome Guest, Not a member yet? Register   Sign In
How can i initialize a userdefined variable.
#2

[eluser]pistolPete[/eluser]
If you use PHP5, you need to define this variable as public:

Code:
class Model_name extends Model {
    
    public $id;

    public function __construct()
    {
        parent::Model();
    }
}

In PHP4 all class variables are public.

Code:
class Model_name extends Model {
    
    var $id;

    function Model_name()
    {
        parent::Model();
    }
}

Now you can access this variable in your controller using:
Code:
$this->model_name->id


Messages In This Thread
How can i initialize a userdefined variable. - by El Forum - 10-22-2009, 04:07 AM
How can i initialize a userdefined variable. - by El Forum - 10-22-2009, 04:15 AM
How can i initialize a userdefined variable. - by El Forum - 10-22-2009, 04:37 AM
How can i initialize a userdefined variable. - by El Forum - 10-22-2009, 04:41 AM
How can i initialize a userdefined variable. - by El Forum - 10-22-2009, 04:57 AM
How can i initialize a userdefined variable. - by El Forum - 10-22-2009, 10:08 PM
How can i initialize a userdefined variable. - by El Forum - 10-23-2009, 03:25 AM
How can i initialize a userdefined variable. - by El Forum - 10-23-2009, 06:11 AM
How can i initialize a userdefined variable. - by El Forum - 10-23-2009, 06:14 AM
How can i initialize a userdefined variable. - by El Forum - 10-23-2009, 06:38 AM
How can i initialize a userdefined variable. - by El Forum - 10-23-2009, 07:00 AM
How can i initialize a userdefined variable. - by El Forum - 10-23-2009, 07:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB