multiple where condition codeigniter

前端 未结 7 1055
感情败类
感情败类 2021-02-01 15:16

How can I convert this query to active record?

\"UPDATE table_user 
 SET email = \'$email\', last_ip = \'$last_ip\' 
 where username = \'$username\' and status =         


        
7条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 16:02

    it's late for this answer but i think maybe still can help, i try the both methods above, using two where conditions and the method with the array, none of those work for me i did several test and the condition was never getting executed, so i did a workaround, here is my code:

    public function validateLogin($email, $password){
            $password = md5($password);
            $this->db->select("userID,email,password");
            $query = $this->db->get_where("users", array("email" => $email));
            $p = $query->row_array();
    
            if($query->num_rows() == 1 && $password == $p['password']){  
                return $query->row();
            }
    
        }
    

提交回复
热议问题