2013-08-02 70 views
0

我收到以下錯誤消息爲每個變量:在codeigniter中返回undefined的變量?

Message: Undefined index:上線59,60,61,62

我不明白爲什麼,因爲它肯定是越來越會話數據,並在數據庫的建立和他們是符合該標準的用戶。

jobs.php(應用功能):

public function apply(){ 

if($this->session->userdata('is_logged_in')){ 
     $this->load->view('header'); 
     $this->load->view('job'); 

     $id = $this->session->userdata('id'); 

     $query = $this->db->get_where('jobseeker_profiles', array('jobseeker_id' => $id)); 
     $user = $query->row_array(); 

     $points = $user['total_points_value']; 
     $name = $user['name']; 
     $email = $user['email']; 
     $jobseeker_profile_id = $user['id']; 
     $employer_profile_id = $this->input->post('employer_id'); 
     $job_id = $this->input->post('job_id'); 

     $this->db->set('jobseeker_profile_id', $jobseeker_profile_id); 
     $this->db->set('employer_profile_id', $employer_profile_id); 
     $this->db->set('job_id', $job_id); 
     $this->db->set('name', $name); 
     $this->db->set('email', $email); 
     $this->db->set('points_value', $points); 

     if($this->input->post('submit')){ 
      $this->db->insert('applications'); 
     } 

     redirect('applied-for'); 

    }else{ 
     redirect('login'); 
    } 
} 
} 

希望完全可以幫助,謝謝!

+2

什麼是在線號碼59,60,61,62? –

+0

一個簡單的Google搜索會給你答案 – Mike

+0

@AmalMurali抱歉,它是四個變量$點,$名稱,$電子郵件和$ jobseeker_profile_id – AyeTry

回答

0

您是否檢查過您在這些行中設置的4個數據庫變量是否在表中正確聲明?他們必須匹配才能工作。

0

做一些簡單的錯誤,直接從控制器或模型檢查類似

// check if query did not come back 
if (! $query = $this->db->get_where('jobseeker_profiles',array('jobseeker_id' => $id))) 
{ echo 'OMFG WHERE IS MY QUERY ???' ; } 
else 
{ $user = $query->row_array(); 

    echo 'QUERY WORKED, User Name is:' . $user['name'] ; 
} 

,如果這也不行,回去,並確保您正在加載的數據庫,用戶/密碼是正確的,等等