我似乎找不到有关如何正确执行此操作的文档...我不能从结果行中提取2列吗?
我的用户模型
// log user in
public function login($email, $password){
// validate
$this->db->where('email', $email);
$this->db->where('password', $password);
$result = $this->db->get('users');
if($result->num_rows() == 1){
return $result->row(0)->user_id;
return $result->row(2)->gamertag;
} else {
return false;
}
答案 0 :(得分:2)
public function login($email, $password){
// validate
$this->db->select('user_id,gamertag');
$this->db->where('email', $email);
$this->db->where('password', $password);
$this->db->from('users');
$result = $this->db->get();
if($result->num_rows() == 1){
return $result->row();
} else {
return false;
}