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

[eluser]chiquitta[/eluser]
Thank you PhilTem and pickupman!

I had try to solve this problem but it still show all account ~
Did I miss something?

my controller
Code:
function index($id = false)
{
  $data['page_title'] = lang('admins');
  $data['admins']  = $this->auth->get_admin_specific($id);
  $this->load->view($this->config->item('admin_folder').'/admins', $data);
}

my model

Code:
function get_admin_specific($id)
{
  $this->CI->db->select('*');
  
  if ($id)
  {
  $this->CI->db->where('id', $id);
  }
  
  $result = $this->CI->db->get('admin');
  $result = $result->result();
  
  return $result;
}

my view

Code:
<?php foreach ($admins as $admin):?>
<?php echo $admin->account; ?>
<?php endforeach; ?>


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



Theme © iAndrew 2016 - Forum software by © MyBB