About Me
Contact Us
Random of Me
Thursday, 21 January 2016
Get One Field in Codeignter
Get one field in Codeignter when we need to extract it in view or controller
here is controller
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Profilepegawai extends AppKaryawan { function __construct() { parent::__construct(); } public function index() { $cu_id_user=$this->session->userdata('cu_id_user'); $data=$this->User_model->detail($cu_id_user)->row(); echo $data->cu_job_desc_id; } }
and here is model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class User_model extends CI_Model { public function cek_user($data) { $query = $this->db->get_where('cu_user', $data); return $query; } function insertuser($user) { $this->db->insert('cu_user',$user); } function detail ($cu_id_user) { $this->db->select('*'); $this->db->from('cu_user a'); $this->db->join('cu_employee b', 'b.cu_id_employee=a.cu_id_user', 'left'); $this->db->join('cu_job_desc c', 'c.cu_job_desc_id=b.cu_job_desc_id', 'left'); $this->db->where('a.cu_id_user',$cu_id_user); return $this->db->get(); }
Thanks for visiting me !
you can grab database is
here
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment