perché devi mettere if (mysql_num_rows($command) == 0) non $query...
OK, grazie.