Welcome Guest, Not a member yet? Register   Sign In
How to set a variable in Construct, or outside of Method?
#3

[eluser]Sanjay Sarvaiya[/eluser]
Your code will look like this:

Code:
class Account_check_model extends CI_Model {
  
  //set user_id variable
    public $user_id;
    
function __construct()
{
  parent::__construct();
  $this->user_id = $this->session->userdata('user_id');
}
    
  //check if activity type has been set
  public function check_activity()
  {
    
    $q = $this->db->where('user_id', $this->user_id)
                  ->limit(1)
                  ->get('u_act_types');
                  
    return $q;

  }


Messages In This Thread
How to set a variable in Construct, or outside of Method? - by El Forum - 06-15-2012, 04:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB