Topic: Unable to fetch topic list for forum

I've just run the phpBB->PunBB converter. When I click on a topic, I get an error:

Error: Unable to fetch topic list for forum.

When I open a post, I get this error:

Error: Unable to fetch post info.

Could you please help me? Thanks!

Re: Unable to fetch topic list for forum

Have you checked that the database is right? Maybe the converter screwed up.

3 (edited by Sander D. 2005-05-18 14:55)

Re: Unable to fetch topic list for forum

Jansson wrote:

Have you checked that the database is right? Maybe the converter screwed up.

Yes, I've screwed up the converter. (It didn't work otherwise.)
But the tables seem to look right. Here are some random export queries:

INSERT INTO `punbb_forums` VALUES (1, 'Donald Duck weekblad', 'Dit Vrolijke Weekblad verschijnt elke week', NULL, 23, 600, 1077120650, 6497, 'jasper mcduck', 0, 0, 10, 2);

INSERT INTO `punbb_topics` VALUES (19, 'Anonymous', 'waarde eerste jaargang DD', 1049809761, 1074879207, 5117, 'SIMSLIM', 554, 75, 0, 0, NULL, 1);

INSERT INTO `punbb_posts` VALUES (52, 'Anonymous', 0, '***.***.***.**', NULL, 'Is er misschien iemand (...)', 1, 1049809761, NULL, NULL, 19);

Maybe you can see what's bad about this?

late edit: removed the IP address

Re: Unable to fetch topic list for forum

Please enable DEBUG mode and try again. It won't work then either, but you'll get a more detailed error message.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Unable to fetch topic list for forum

Okay, done that. New error:

File: /var/www/html/forum/viewforum.php
Line: 129

PunBB reported: Unable to fetch topic list for forum
Database reported: You have an error in your SQL syntax near '' at line 1 (Errno: 1064)

It must be this line:

$result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());

Probably it's because I've got one member with a ' in his name... Maybe something can be fixed?

6

Re: Unable to fetch topic list for forum

Well what was up with the converter? I ran it perfectly :D

What versions of PunBB and phpBB were you running?

Re: Unable to fetch topic list for forum

Joey wrote:

Well what was up with the converter? I ran it perfectly big_smile

I had to change the queries, because my database name is mcduck_nl_-_forum and '-' isn't allowed in queries. And somebody uses a ' in his name, so I had to change that query.

Joey wrote:

What versions of PunBB and phpBB were you running?

phpBB: 2.0.3
PunBB: 1.1.2

Re: Unable to fetch topic list for forum

Could you try echoing out that query instead of executing it? I.e. replace:

$result = $db->query('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());

with

dump('SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, last_post DESC LIMIT '.$start_from.', '.$disp_topics);

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Unable to fetch topic list for forum

Output:

Warning: Division by zero in /var/www/html/forum/viewforum.php on line 119

SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM punbb_topics WHERE forum_id=9 ORDER BY sticky DESC, last_post DESC LIMIT 0,

Re: Unable to fetch topic list for forum

Aha, now I think I know! What is "Topics per page default" and "Posts per page default" set to in admin/options? If they're set to nothing, that's the problem.

It's actually a bug in PunBB. You shouldn't be able to set them to nothing.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Unable to fetch topic list for forum

Ah, great, thanks! It works now.

Great system, PunBB. Much better than phpBB, I think.

Re: Unable to fetch topic list for forum

No worries. I'm just glad we found the problem :)

The next release of PunBB will incorporate the fix.

"Programming is like sex: one mistake and you have to support it for the rest of your life."