I'm happy to write my own but if there's a really nice PHP script out there that i can just run on a cron and exclude directories then i'd love to hear about it!
I'd prefer to use a scraper/crawler type script than write the XML from the database....
http://code.google.com/p/sitemap-generators/wiki/SitemapGenerators
As far as the database interaction, you can adapt one of the above.