你好家伙我正在codeigniter框架上进行应用,我试图回应特定用户的用户信息,但它并不真正起作用。这个名字没有被回应。还有我的数据库中用户的所有电子邮件都被回显。呼应在Codeigniter中不起作用的用户信息
(向右TUSER配置文件中的链接的作品,虽然,但链接的名称不会在其空白链接 这是我的看法文件:。
foreach($userdetail_list as $row): ?>
<tr>
<td>
<a href="<?php echo base_url() . 'User/userdetails/'.$row['user_id']?>">
<?php echo $row['voornaam']; ?>
</a>
</td>
<td>
<?php echo $row['email'];?>
</td>
</tr>
<?php endforeach; ?>
我的模型文件:
function getdata($user_id){
$this->db->select("*");
$this->db->from('users');
$this->db->where('user_id', $user_id);
$query = $this->db->get();
return $query->result();
}
public function getUserInfo($user_id) {
$arrReturn = array();
$this->db->select('*');
$this->db->from('users');
$this->db->where('user_id', $user_id);
$query = $this->db->get();
$result = $query->result_array();
if (!empty($result)) {
$arrReturn = $result[0];
}
return $arrReturn;
}
我的控制文件:
public function userdetails($user_id)
{
//load the User_model
$this->load->model('User_model');
//call function getdata in de Product_model
$data['userdetail_list'] = $this->User_model->getdata($user_id);
$data['user'] = $this->User_model->getUserInfo($user_id);
//laad view
$data['main_content'] = 'profiel_user';
$data['main_content'] = 'details';
$this->load->view('profiel_user',$data);
}
所以基本上在视图文件,我只W¯¯蚂蚁1电子邮件正在呼应1特定用户使用user_id而不是所有的用户电子邮件,我也希望看到没有被回显的视图页面上的名称和它的空白链接。名称= voornaam
你试图让多个用户的相关信息以列表? – user4419336
user_id – JohnDoe122
不仅有1位用户可能重复[用户名未回显](https://stackoverflow.com/questions/46545629/user-name-is-not-being-echoed) – DFriend