1

Topic: I nearly allways get "could not fetch topic list"

How do I fix that?

My forum is located at http://www.codeshack.se/forum if you wanna look at it. You'll probalby get tha same error. I'm running version 1.0 RC 2 with Mysql.

Thanks

2

Re: I nearly allways get "could not fetch topic list"

why not run version 1.0.1

3

Re: I nearly allways get "could not fetch topic list"

I have modded it pretty much, so it would be good if i could use the same version as I use now.

4

Re: I nearly allways get "could not fetch topic list"

uhm, just mod version 1.0.1

5

Re: I nearly allways get "could not fetch topic list"

Maybe. But If someone can help me to just make my version work, that would be much better.

6

Re: I nearly allways get "could not fetch topic list"

no it wouldn't, because release candidates have errors....

7

Re: I nearly allways get "could not fetch topic list"

Hmm. okay.. Then I'm afraid I have to upgrade anyway..

8

Re: I nearly allways get "could not fetch topic list"

this could be a problem with rc2 itself, other than thatb i cant think of anything.

Re: I nearly allways get "could not fetch topic list"

Enable DEBUG. Try it again and paste the error message here.

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

10 (edited by Woppe 2003-09-13 20:19)

Re: I nearly allways get "could not fetch topic list"

It says:

An error was encountered
File: /home/httpd/ws2464/codeshack.se/forum/viewforum.php
Line: 144

PunBB reported: Unable to fetch topic list for forum
Database reported: You have an error in your SQL syntax near 'WHERE t.id IN(0,6,14) ORDER BY sticky DESC, last_post DESC' at line 1 (Errno: 1064) 


On that line I have

$result = $db->query('SELECT DISTINCT p.poster_id AS hasposted, t.id, t.poster, t.subject, 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 FROM
'.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p'.$useindex.' ON t.id=p.topic_id AND p.poster_id='.$cur_user['id'].' WHERE t.id IN('.$threadids.') ORDER BY sticky DESC, last_post DESC') or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());
}

Re: I nearly allways get "could not fetch topic list"

That's odd. Could you try adding the following just above that line:

exit('SELECT DISTINCT p.poster_id AS hasposted, t.id, t.poster, t.subject, 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 FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p'.$useindex.' ON t.id=p.topic_id AND p.poster_id='.$cur_user['id'].' WHERE t.id IN('.$threadids.') ORDER BY sticky DESC, last_post DESC');

And then paste the results here.

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

12

Re: I nearly allways get "could not fetch topic list"

If I paste that code just before, and then try to view the page I come to a page with this source:

<table class="pun_plain" cellspacing="1" cellpadding="4">
    <tr>
        <td style="width: 53%"><b><a href="index.php">Codeshack</a> / PHP</b></td>
        <td class="pun_right" style="width: 28%"> </td>
        <td class="pun_right" style="width: 19%; white-space: nowrap"><b><a href="post.php?fid=1">Skapa ny tråd</a></b></td>
    </tr>
</table>

<table class="pun_main" cellspacing="1" cellpadding="4">
    <tr class="pun_head">
        <td class="pun_head" style="width: 24px"> </td>
        <td class="pun_head" style="width: *; white-space: nowrap">Tråd</td>
        <td class="pun_head" style="width: 14%; white-space: nowrap">Skapare</td>
        <td class="pun_headcent" style="width: 7%; white-space: nowrap">Svar</td>
        <td class="pun_headcent" style="width: 7%; white-space: nowrap">Visningar</td>

        <td class="pun_head" style="width: 25%; white-space: nowrap">Senaste inlägget</td>
    </tr>
SELECT DISTINCT p.poster_id AS hasposted, t.id, t.poster, t.subject, 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 FROM pun_topics AS t LEFT JOIN pun_posts AS p ON t.id=p.topic_id AND p.poster_id=1 WHERE t.id IN(0,6,14) ORDER BY sticky DESC, last_post DESC

I think somethings really outta order here wink

Re: I nearly allways get "could not fetch topic list"

It is supposed to do that. Don't worry :)

However, I can't see what's wrong with the query. It seems fine to me. Hmm.

Edit: I just checked out your forum and it appears to work fine. Have you solved the problem?

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

14 (edited by ps21 2003-09-13 23:34)

Re: I nearly allways get "could not fetch topic list"

Codeshack forum works fine for me. I checked it out just after I saw the post and it was fine then too.

15 (edited by Woppe 2003-09-14 07:37)

Re: I nearly allways get "could not fetch topic list"

i NEARLY allways get that error. Thats the problem!

Do you thing that I have to upgrade?

Re: I nearly allways get "could not fetch topic list"

No, it must be an issue with your database. Try running REPAIR TABLE on all the tables.

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

17

Re: I nearly allways get "could not fetch topic list"

How do I do that? Is that a command?

18 (edited by Piggymon 2003-09-14 17:30)

Re: I nearly allways get "could not fetch topic list"

It's a SQL command. Access your (my)SQL database, USE yourpundatabase; SHOW TABLES; REPAIR TABLE tablename; on all tables.

-

19

Re: I nearly allways get "could not fetch topic list"

I have ran that command now, and I haven't got any error-message yet. I'll inform you if I get one.

Re: I nearly allways get "could not fetch topic list"

I don't get any error on your forum...

21

Re: I nearly allways get "could not fetch topic list"

I friend have noticed a relation with logging in from the script-archive or the article-system. When you log in from the forum or don't log in at all, everything works fine. But when you log in from the script-archive or the article-system, you get the error message.

Do you think of anything that could be wrong when you read this?

Re: I nearly allways get "could not fetch topic list"

I didn't realize you had made your own "additions" to the forum, so I really can't say. My best guess is that $cur_user for some reason doesn't get defined when login in through the script archive.

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

23

Re: I nearly allways get "could not fetch topic list"

I'll check that out. But now it time to "snutta kudde" wink

24

Re: I nearly allways get "could not fetch topic list"

$cur_user['username'] is not set, so I suppose everything else that have to do with $cur_user isn't set either. How can I be sure that $cur_user sets? Can you give me the code for that? I can't find what part it is..

Re: I nearly allways get "could not fetch topic list"

It's all in common.php.

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