An error has occured - answers not found!"; return; } $i = 1; while( !feof( $answers ) ) { $a = fgets( $answers, 256 ); if( $i == $jokeNo ) { echo "$a"; fclose( $answers ); return; } ++$i; } fclose( $answers ); echo "The answer was not found to that joke"; ?>