public function user_data_vi($email)
{
$this->db->select('*');
$this->db->from('client');
$this->db->join('payments', "payments.email = $email");
$q= $this->db->get();
return $q->result();
}
上面的代码是我的模型和方法user_data_vi
我在两个表client
字段中有两个表payments
而另一个email
现在很常见我想要从数据库中检索数据第一个表具有用户信息,payment table
具有付款信息,使用电子邮件字段获取两个表数据信息。
答案 0 :(得分:0)
您需要在此处添加where条件,请在下面找到修改后的代码
public function user_data_vi($email)
{
$this->db->select('*');
$this->db->from('client');
$this->db->join('payments', "payments.email = client.email");
$this->db->where('client.email',$email);
$q= $this->db->get();
return $q->result();
}
答案 1 :(得分:0)
public function user_data_vi($email)
{
$this->db->select('*');
$this->db->from('client');
$this->db->where('client.email',$email);
$this->db->join('payments','payments.email = client.email');
$q= $this->db->get();
return $q->result();
}