If both user have same login credentials. They are creating records. but, one user not allowed to view other user record created by other.
If i created one column in database name “user_status” and adding condition for both user . condition A for one user and B for another user.
Now, my question is how i will find the user status for that users who belong to which status.
Can you help me to find out the issue.
You need to generate a session variable in CodeIgniter after login success or error
<?php if($login){ $this->session->set_userdata('user_id',$user_id); redirect("home"); } else{ $this->session->set_flashdata('error', 'Login details not match'); redirect("login"); } ?>
if your page redirects into the home page, you can get user details by user session variable.
<?php $this->db->select('*'); $this->db->from('table'); $this->db->where('id',$this->session->userdata('user_id')); $select_data=$this->db->get()->result_array(); echo $select_data[0]['user_status'] ?>
Question and answer is powered by AnsPress.io