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

[eluser]chiquitta[/eluser]
I had met a basic problem that i want to show specific 'account' not all account data from database.

I don't know how to do.
Please help me! And it will be really helpful for me.
Now I write the code like this:

my controllers
Code:
function index()
{
  $data['page_title'] = lang('admins');
  $data['admins']  = $this->auth->get_admin_list();

  $this->load->view($this->config->item('admin_folder').'/admins', $data);
}

my model
Code:
function get_admin_list()
{
  $this->CI->db->select('*');
  $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;
}
my views
Code:
<?php foreach ($admins as $admin):?>
<?php echo $admin->account; ?>
<?php endforeach; ?>

Just like the pic below
If the user's account is chiquitta
when user need to edit her account setting
It should only show her account information not all of the account information from database.


Messages In This Thread
how should I show specific data not all data from database? - by El Forum - 12-25-2012, 08:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB