This problem shows itself by having the proper category shown for posts, but the attachment (a photo) used as a thumbnail and then the link being 'page'. Clicking on the attachment (photo) in the post will show the attachment page with the category listed as my default category - which happens to be 'Uncategorized'.
There is a DB table called post2cat that holds all the category IDs for all posts (and attachments). BUT, WP is not writing the category ID to the attachments. It's writing the default ID (uncategorized) no matter what I select in the categories check boxes. What's most baffling is that it appears to work on an older install (2.2.1) on a different domain on the same web server. That's what's really bugging me. I've compared the two server environments and they are identical (which is as it should be - it's a shared environment with php as apache mod).
I've tried all sorts of things to get this to work, but I'm at a loss as to why I the category ID is not written to the post2cat table for attachments.
WP 2.2.2 - fresh install/default template
Apache version 2.0.61
PHP version 5.2.4
MySQL version 4.1.22-standard