Welcome Guest, Not a member yet? Register   Sign In
How to get data objects in controller
#5

I still can't get it working, I'll try and break the code down into it's simplest parts:

In my model:
// will include the password later
public function jobseekersLogin($email, $password) {

  $this->db->select('*');
  $this->db->from('jobseekers');
  $this->db->where('lc_email', $email);
  $this->db->limit(1);
  $query = $this->db->get();

  if ($query->num_rows() == 1) {
    return $query->result_array();
    } else {
      return false;
      }
  }

in my controller:

// This is returning a large array as tested with print_r
$data['user'] = $this->jobseekers_model->jobseekersLogin($jbsEmail, $jbsPassword);

107: $userId = $data['userData']['lc_id'];

A PHP Error was encountered
Severity: Notice
Message: Undefined index: lc_id
Filename: controllers/Jobseekers.php
Line Number: 107
Backtrace:

lc_id is the primary id column in the database, I would have thought with this code all columns would now be available i.e
$userId = $data['userData']['email];
$userId = $data['userData']['first_name'];

etc etc?
Reply


Messages In This Thread
RE: How to get data objects in controller - by barrypoore - 04-09-2018, 09:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB