The usual apologies for being a newb & asking stupid questions... but I'm am using Codeigniter for a basic CRUD app.
Code PHP:
elseif ($data['records']['qualified_lvl'] == 1)
all three of my else-if's are telling me ['qualified_lvl'] is an undefined index, but I'm able to print it out in the view... maybe it's suppose to be a property instead of an index, but the syntax I thought I understood for that is returning undefined variable.
I suppose the view is adding the for each loop, but there seems to be something about the syntax that I am missing.
In the controller:
Code PHP:
function i_wanna_mow() {	$this -> load -> model('membership_model');
		$data['records'] = $this -> membership_model -> getMOWERSRow();
		if ($data['records'] == NULL) {
			$data['main_content'] = 'i_wanna_mow';
			$this -> load -> view('includes/template', $data);
		} elseif ($data['records']['qualified_lvl'] == 1) {
			$data['main_content'] = 'i_wanna_mow';
			$this -> load -> view('includes/template', $data);
		} elseif ($data['records']['qualified_lvl'] == 2) {
			$data['main_content'] = 'i_wanna_mow';
			$this -> load -> view('includes/template', $data);
		} elseif ($data['records']['qualified_lvl'] == 3) {
			$data['main_content'] = 'i_wanna_mow';
			$this -> load -> view('includes/template', $data);
		} else {
			$data['main_content'] = 'i_wanna_mow';
			$this -> load -> view('includes/template', $data);		}
	}
and in the model it is calling...
Code PHP:
function getMOWERSRow() {
		$this -> db -> where('username', $this -> session -> userdata('username'));
		$this->db->join('mowermen', 'mowermen.id =  members.id', 'left');
 
		$query = $this -> db -> get('members');
 
		if ($query -> num_rows == 1) {
			foreach ($query->result() as $row) {
				$data[] = $row;
			}
			return $data;}
	}