Your query will always return one row, COUNT()
will return the number of rows that match your WHERE
clause. You can either select something that is not an aggregate function, or compare to the value that is returned. The easiest fix would be to change your COUNT('iD')
to just simply ID
, so your $query
line will be $query = "SELECT iD FROM eif WHERE userName = '$user'";
This will make it so that your $return_rows
variable returns the correct value.