codeigniter acsess数据与查询

时间:2013-11-04 06:09:42

标签: php codeigniter login

我的项目有错误,你能帮我吗?这是我的代码:

$q_cek_login = $this->db->get_where('tbl_karyawan', array('username' => $u, 'password' => $p));
    if(count($q_cek_login->result())>0)
    {
        foreach($q_cek_login->result() as $qck)
        {

            if($qck->id_jabatan==1)
            {
                foreach($q_cek_login->result() as $qad)
                {
                    $sess_data['logged_in'] = 'yesGetMeLogin';
                    $sess_data['username'] = $qad->username;
                    $sess_data['nama_pengguna'] = $qad->nama;
                    $sess_data['id_jabatan'] = $qad->id_jabatan;
                    $this->session->set_userdata($sess_data);
                }
                //header('location:'.base_url().'pemesanan/pending');
            }
        }
    }

然后我收到此错误:

遇到PHP错误

严重性:注意

消息:未定义的属性:stdClass :: $ id_jabatan

文件名:models / model_digor.php

行号:26

你们所有人..........

1 个答案:

答案 0 :(得分:0)

请检查您的依赖类是否已正确加载。例如$ this-> load-> library('database');或$ this-> load-> library('your_built_in_class');