I am running a mysql statement which actually evaluates to true despite the incorrectness of a value. Bellow is the function
<?php
public function login_user($username, $password){
if(!empty($username) && !empty($password)){
$sql = "SELECT * FROM `users` WHERE `user_name`='$username' AND `user_password`='$password'";
$query = $this->link->query($sql);
if($this->link->error){
//return false;
$this->log_db_error($this->link->error, $sql);
return false;
}
else{
return true;
}
}
else{
return false;
}
}
?>
Calling this function with the params and passing a correct username and a wrong password actually returns true, where am I messing up? Any help