while ( $flag == 0 && ( $userId = $sth->fetchrow_array() ) ) {...}