Topic: Unable to fetch topic list.

When logged into my forum I get the following message when trying to view *ANY* forum.

Unable to fetch topic list.

When not logged in all appears ok.  I am using PUNBB v1.2.4 (I know there is a new version but am unable to upgrade at the moment). and using 

    Operating system: WINNT
    PHP: 5.0.1 - Show info
    Accelerator: N/A
    MySQL 4.0.22-nt
    Rows: 5350
    Size: 678.12 KB

Any help appreciated as this was working fine this morning.

rgds

Re: Unable to fetch topic list.

Enable debug mode, post the full message here

Re: Unable to fetch topic list.

Thanks for the quick response. I have managed to fix the problem, however I am not sure wether the original problem is of my own making (I installed a poll) or inherant

I made two small changes to the board, they are

Changed option "User has posted earlier" to yes
Changed option "Quick post" to no

This, from my basic understanding of PHP changed the flow of execution within viewforum.php the following code shows..

// Fetch list of topics to display on this page
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
{
    // Without "the dot"
    //$sql = '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, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
    $sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to, question FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
}
else
{
    // With "the dot"
    switch ($db_type)
    {
        case 'mysql':
        case 'mysqli':
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.question FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' OR t.announcement!=\'1\' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
            break;

        case 'sqlite':
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.question FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' OR announcement!=\'1\' ORDER BY announcement DESC, sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
            break;

        default:
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.question FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.question, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
            break;

    }
}

The problem as reported with debug info, was:

File: G:\Domains\fbtalk.net\wwwroot\viewforum.php
Line: 141

PunBB reported: Unable to fetch topic list

Database reported: Unknown column 't.announcement' in 'where clause' (Errno: 1054)

rgds and thanks for the debug mode pointer smile

4 (edited by Smartys 2005-06-02 16:19)

Re: Unable to fetch topic list.

The issue is here
OR t.announcement!=\'1\'

There message says there was no announcement column, which makes me think you were installing a mod but forgot to run install_mod.php to do the databases changes.

Was it this mod by any chance?

Re: Unable to fetch topic list.

It wasn't that mod, it was the mod that allowed me to add polls to the board, thanks for the feedback and help smile

rgds