CodeIgniter Forums

Full Version: i have an error A PHP Error was encountered Severity: Notice Message: Undefined property: Auth::$module Filename: co
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]tusukgigi[/eluser]
help,

i have an error

Code:
A PHP Error was encountered  Severity: Notice  Message: Undefined property: Auth::$module  Filename: core/Model.php  Line Number: 51

this is my code in application/core/My_Model.php
Code:
<?php class MY_Model extends CI_Model {

function MY_Model(){
  
  parent::__construct();

  //set config options
  //$res = $this->db->get_where('options', array('category'=>$this->uri->segment(2)));
  $module = ($this->module == NULL) ? $this->uri->segment(2) : $this->module;
  $res = $this->db->query("SELECT * FROM options WHERE category IN ('$module','general')");
  
  
  foreach($res->result_array() as $row){
   $result_arr[$row['option_name']] = $row['option_value'];
   //use CI's config class
   $this->config->set_item($row['option_name'], $row['option_value']);
  }
  
  $this->options = $result_arr;
}

/**
  * Return an option value, for use outside of the model
  *
  * @deprecated use config_item(); (CI globally available)
  *
  * @param string $option_name
  * @return string
  */
function getOption($option_name){
  return $this->options[$option_name];
}
}