I'm trying to create a duplicate check with PHP and MySQL and have now tried many different varieties. Nevertheless, my code does not show if the user name already exist. As far as I know this should be the right (of many) formula for a functional duplicate check?

```
  $username = "heihei";
  $checkquery = mysqli_query($con,"SELECT * FROM users 
  WHERE username='$username'") or die(mysqli_error());  
  if (mysqli_num_rows($checkquery)) {
     echo ">0" ; 
  }else {
     echo "0" ; 
 }

```

User table looks like this:

```
ID    USERNAME
1     heihei
2     neinei

```

When defining `$username` as `heihei`, result is `0`.

Result is the same if I define `$username` as `something`.

It will show that the user don't exists already.

**What is the problem here?**