When I do a SQL search in phpMyAdmin (substituting the variable for the actual value) it returns the correct row number but when using PHP to return this value it always returns 1 no matter what. Thanks in advance.

```
function user_exists($username) {
    $link = mysqli_connect('localhost','root','','test');
    $username = sanitize($username);
    $query = mysqli_query($link, "SELECT COUNT(`user_id`) FROM `new_base` WHERE `username`='$username'");
    $row_cnt = mysqli_num_rows($query);
    echo $row_cnt;
    mysqli_free_result($query);
    mysqli_close($link);
}

```