Topics, No Posts In PHPBB3 After PHPBB2 Conversion

Saturday night / Sunday was spent doing a total forum upgrade on, moving from phpBB2.0.22 (legacy) to phpBB3.

In doing the upgrade I needed to install a new copy of phpBB3, change a few URLs, download my phpBB2 database locally, convert it to the phpBB3 standard (due to timeouts on the server), upload the new database and everything was supposed to be grand.

I won’t claim to know everything about the ins and outs of phpBB’s database structure but I’d have a fair idea of where things go.

Flash forward an hour or so, the forum goes live once again, replying to old posts is no problem, some of the avatars missing (no big deal, only 3-4 of them site-wide) but new topics were posing a problem.

The posts were appearing, visible in their respective forums, times and authors correct, but clicking on them would tell you the topic didn’t exist. A quick search on Google revealed nothing so some time was spent digging through the database when I noticed the topic ID’s weren’t being set in either the X_topics or X_posts table (where X denotes your phpbb3 table prefix).

The cause of this, possibly happening during the conversion, was the topic_id field in X_topics not incrementing on posts. i.e. the field should be set to auto increment, thus solving the problem of their ID’s being set to 0.

If you’ve got access to phpMyAdmin, log into your database, select your X_topics table (by clicking on it’s name) and hit the ‘structure’ tab when your table loads. Edit the topic_id field (pencil icon in the row) and in the extras column, add the option to auto increment.

Presto, your posts start reappearing.

If you’ve made posts yourself (as I had done) you’ll need to set the topic IDs manually through the database as you can’t access the post from the forum in order to delete it. In setting the topic’s ID, browse your X_topics table and sort the order by topic_id (descending). Your faulty topic should have an ID of 0, so replace it’s 0 ID with the next number you see in the sequence. e.g. You sort your table by ID in descending order and see the sequence 3412, 3411, 3410. The number for your new (and presently faulty) post should be 3413.

The posts table was fine, the post IDs auto incrementing as they should have done, but the post wasn’t picking up the topic ID so you’ll have to enter the same topic ID into your X_posts table – that or delete the post, it’s up to you.

Having assigned the proper topic IDs in the database, the posts reappeared online while setting the topic_id field in X_topics to auto increment prevented the problem from raising it’s head again.

Confused? Or have you had better luck with your conversion?


  1. Anthony February 12, 2008 at 9:03 am

    Updated about a month or so back and had no problems at all. Must have just got lucky.

  2. Ken McGuire February 12, 2008 at 9:11 am

    Can’t understand where in the update the topics would have stopped auto incrementing. It was literally download -> convert -> upload before it broke.

    Still, I’ve one more set of boards to replace so hopefully lightning doesn’t strike twice!

  3. John February 12, 2008 at 9:32 am

    How’s phpBB3 for spam, much improved I hope?

  4. Ken McGuire February 12, 2008 at 9:43 am

    Well, there’s been no spam Saturday / Sunday / Monday which I’ll take as a good sign. Could usually guarantee late weekend being the hardest hit. I’ll let it play out during the week.

    With phpbb2 I had tightened the security as much as I could, it would allow spam registrations but no posts. Hasn’t been a single spam registered user since I reopened the forum on Sunday afternoon. Small victory for the moment.