CodeIgniter Forums
Manage Users in Redux, need help (new to CI) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Manage Users in Redux, need help (new to CI) (/showthread.php?tid=19680)



Manage Users in Redux, need help (new to CI) - El Forum - 06-15-2009

[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!