```
public function doesUserExist($u) {

    $this->dbConnect();

    mysql_select_db($this->database);

    $sUser = mysql_real_escape_string($u);

    $query = "SELECT username FROM $this->table WHERE username='$sUser'";
    $doesFieldExist = false;

    if (mysql_num_rows($query) > 0) {
        $doesFieldExist = true;
    }

    $this->dbDisconnect();

    return $doesFieldExist;

}

```

I get an error on this line (60)

```
if (mysql_num_rows($query) > 0) {

```

The error is:

```
Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:\Users\Tom\Dropbox\public_html\classes\database.class.php on line 60

```

With the query I'm using, mysql\_num\_rows($query) should return 1. I've googled and checked here, but can't see what I'm doing wrong.