Checking if the query is empty does not work

Your query includes a test for quy to be non-zero, so you will never run into the situation where empty($row->quy) will be true. Furthermore, you should be testing if $rows is set or is null since you indicated that “nothing is displayed when the query is empty.”

You will need to rewrite your code to test the result of the query to test for the null condition. If it is null, then the user is registered. Otherwise, they are not registered.