i'm trying to run a very simple PHP function :

```
function evalLoggedUser($db_conx,$id,$e,$p){
$sql = "SELECT ip FROM users WHERE id={$id} AND email= '$e' AND password= '$p' AND activated=1 LIMIT 1 ";
    $query = mysqli_query($db_conx, $sql);
    $numrows = mysqli_num_rows($query);
    if($numrows > 0){
        return true;
    } else {
        echo $sql;
    }
}

```

as part of a user authentication. The problem is that the query is not working and I dont know why! I know the mysql connection is working as I have checked the mysqli\_errno and not getting anything there - Can anyone help?