我試圖顯示每個users.Help e,以解決這個問題..我的意思是我想精確查詢...在此先感謝以下是用戶控制器我要個人計數對於codeigniter中的每個用戶
用戶控制器:
function GetCandidate($options = array()) {
if(isset($options['candidateId']))
$this->db->where('candidateId',$options['candidateId']);
if(isset($options['userId']))
$this->db->where('canUserId',$options['userId']);
if(isset($options['userBranch']))
$this->db->where('canUserBranch',$options['userBranch']);
if(isset($options['candidateFname']))
$this->db->where('candidateFname',$options['candidateFname']);
if(isset($options['candidateMname']))
$this->db->where('candidateMname',$options['candidateMname']);
if(isset($options['candidateLname']))
$this->db->where('candidateLname',$options['candidateLname']);
if(isset($options['candClient']))
$this->db->where('candClient',$options['candClient']);
if(isset($options['candRequirement']))
$this->db->where('candRequirement',$options['candRequirement']);
if(isset($options['activateddate']))
$this->db->where('activateddate',$options['activateddate']);
if(isset($options['limit']) && isset($options['offset']))
$this->db->limit($options['limit'], $options['offset']);
else if(isset($options['limit']))
$this->db->limit($options['limit']);
if(isset($options['join'])){
$this->db->select('can . * ,c.clientName,r.requirementName,r.designation,u.userName,u.userMName,u.userLName');
$this->db->from('candidates as can');
$this->db->join('clients as c','can.candClient=c.clientId ');
$this->db->join('requirement as r','r.requirementId=can.candRequirement');
$this->db->join('users as u','can.canUserId=u.userId ');
$this->db->order_by("candidateId", "desc");
$query = $this->db->get();
if(@$options['candidateId']) return $query->row(0);
return $query->result();
}
$this->db->order_by("candidateId", "desc");
$query = $this->db->get('candidates');
if(isset($options['count'])) return $query->num_rows();
if(@$options['candidateId']) return $query->row(0);
return $query->result();
}
網友觀點:候選人的
function manage(){
$userId = $this->phpsession->get("userId");
$userType = $this->phpsession->get('userType');
$date = date("Y-m-d");
if(!$userId && !$this->phpsession->get("userType")){
redirect(base_url());
}
$options['join'] = true;
$data['users'] = $this->user_model->GetUser($options);
$data['totalprofile'] = $this->candidate_model->GetCandidate(array("count"=>true));
$data['page_title']="User Details";
$this->layout->view("user/manage",$data);
}
型號:
<th style="width: 5px">UID</th>
<td><?php echo $totalprofile; ?>