The time limit in php.ini is by default 30 seconds, but its just a default. With the set time out function mentioned above, you can actually have your script override that value. Its handy yet dangerous if you're not careful.
As for the updating as it goes trick, there's some tricks to playing with the buffer. You need to tell PHP you want buffered output (ob_start() I believe). Then after your print statement, put in flush(). That will tell PHP to send whatever data it has collected.
The trick with this is some browsers (like IE) like to do their own caching and they may not immediately show you the results as they come up. Basically, you may have your PHP script setup correctly, but the browser may still botch up the effect. The other trick is this will create a printed page that keeps growing with the last record count at the very bottom of the page. This usually isn't the best user experience.
The only other way I can think of which is a bit more reliable but much slower is to have your page recursively call itself each time and each time it send out a new count. I've seen this get stuck as well so your mileage may vary.