eoinzy wrote:There are still topics where it says the last user to post was the deleted spam user. When I click on the username, it says the user does not exist anymore.
When you delete a user, you have the choice of deleting all their posts or keeping them. If you used the latter option, the member profile is deleted and the posts associated with that (former) member are assigned to "Guest" (anonymous). Since the name of the (former) member is known, the post's poster name is retained. So, for example, if you delete user "SpamFan" and don't
choose the "delete all posts" option, the poster ID is set to anonymous (ID = 1) and the poster name is kept as "SpamFan". It may seem a little odd that you have the option of keeping named anonymous users in your database, but presumably the folks at phpBB thought it was a good idea for cases where you want to ban someone but keep their posts intact.
It sure would be nice if this tool handled removal of named anonymous posts, but it doesn't appear to... http://www.phpbb.com/support/stk/
I don't have a SQL script to correct the problem, but it's not terribly messy, assuming you don't allow Guest posts on your board. If you don't allow Guest posts, then you should be able to delete all records by Guest (poster_id = 1) in the posts table and then reset the topic_last_poster_name and topic_last_poster_id column in the topics table. In case it's not clear, the topics table has some of this meta-information about the posts table to avoid an expensive join. As a consequence, the two tables can become unsync'd as yours has.
By the way, to avoid any surprises, I recommend testing the above on a LOCAL server, not your live board. Here's how to setup one:How to set up a local server using xampp
PS: Remember to purge the cache after updating your database, otherwise you'll continue to see "bogus" entries in your forum until they expire.