Welcome Guest, Not a member yet? Register   Sign In
how should I show specific data not all data from database?
#3

[eluser]pickupman[/eluser]
By using an extra parameter to your get_admin_list method, will give you both in one.
Code:
function get_admin_list($id = FALSE)
{
  $this->CI->db->select('*');

  if ($id)
  {
      $this->db->where('id', $id);
  }

  $this->CI->db->order_by('image', 'ASC');
  $this->CI->db->order_by('account', 'ASC');
  $result = $this->CI->db->get('admin');
  $result = $result->result();
  
  return $result;
}

Now if you pass an id to the method, you will get back that specific user. Or if you don't pass anything, you will get all admins. This allows you to set id to FALSE, if a user is a super admin, and be able to view all other admins.


Messages In This Thread
how should I show specific data not all data from database? - by El Forum - 12-26-2012, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB