Welcome Guest, Not a member yet? Register   Sign In
Manage Users in Redux, need help (new to CI)
#1

[eluser]aaronr[/eluser]
I'm new to CI. So any kind of help would be great.

I am using Redux to deal with user authentication. It does not seem to come with something to manage users so I am trying to write something to do so. I am trying to just list users.

I have this listing find:
username | email | group
admin | [email protected] | 1

But want to instead of show the group_id, I want the name of the group, not the id.

Is there a smarter way to do this in the controller:

function index()
{
$data['title'] = "User Management";
$data['heading'] = "Users";
$data['query'] = $this->db->get('users');

// grabbing the group_id from meta.group_id
$this->db->select ('*');
$this->db->from('meta', 'groups');
$this->db->where ('group_id');
$this->db->join('users', 'meta.user_id = users.id');
$this->db->join('groups', 'users.id = groups.id');
$date['query'] = $this->db->get();

$this->load->view('user_view', $data);
}

(Actually, it is not returning the group name, no biggy, I'll figure that out once I know if there is a better way to do this, I'm used to Rails "magic")

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB