Het heeft met netjes programmeren niet zo veel te maken, maar ik heb in fetchposts.php:
Code: Selecteer alles
$sql = 'SELECT
t.topic_id,
t.topic_time,
t.topic_title,
pt.post_text,
u.username,
u.user_id,
t.topic_replies,
pt.bbcode_uid,
t.forum_id,
t.topic_poster,
t.topic_first_post_id,
t.topic_status,
pt.post_id,
p.post_id,
p.enable_smilies
FROM
' . TOPICS_TABLE . ' AS t,
' . USERS_TABLE . ' AS u,
' . POSTS_TEXT_TABLE . ' AS pt,
' . POSTS_TABLE . ' AS p
WHERE
t.forum_id IN (' . $forum_sql . ') AND
t.topic_time <= ' . time() . ' AND
t.topic_poster = u.user_id AND
t.topic_first_post_id = pt.post_id AND
t.topic_first_post_id = p.post_id AND
t.topic_status <> 2
ORDER BY
t.topic_time DESC';
veranderd in:
Code: Selecteer alles
$sql = 'SELECT
t.topic_id,
t.topic_time,
t.topic_title,
pt.post_text,
u.username,
u.user_id,
t.topic_replies,
pt.bbcode_uid,
t.forum_id,
t.topic_poster,
t.topic_first_post_id,
t.topic_status,
pt.post_id,
p.post_id,
p.enable_smilies
FROM
' . TOPICS_TABLE . ' AS t,
' . USERS_TABLE . ' AS u,
' . POSTS_TEXT_TABLE . ' AS pt,
' . POSTS_TABLE . ' AS p
WHERE
/* t.forum_id IN (' . $forum_sql . ') AND */
t.topic_time <= ' . time() . ' AND
t.topic_poster = u.user_id AND
t.topic_first_post_id = pt.post_id AND
t.topic_first_post_id = p.post_id AND
t.topic_status <> 2
ORDER BY
t.topic_time DESC';
en
Code: Selecteer alles
$sql = 'SELECT
t.*,
vd.*
FROM
' . TOPICS_TABLE . ' AS t,
' . VOTE_DESC_TABLE . ' AS vd
WHERE
t.forum_id IN (' . $forum_sql . ') AND
t.topic_status <> 1 AND
t.topic_status <> 2 AND
t.topic_vote = 1 AND
t.topic_id = vd.topic_id
ORDER BY
t.topic_time DESC
LIMIT
0,1';
veranderd in:
Code: Selecteer alles
$sql = 'SELECT
t.*,
vd.*
FROM
' . TOPICS_TABLE . ' AS t,
' . VOTE_DESC_TABLE . ' AS vd
WHERE
/* t.forum_id IN (' . $forum_sql . ') AND */
t.topic_status <> 1 AND
t.topic_status <> 2 AND
t.topic_vote = 1 AND
t.topic_id = vd.topic_id
ORDER BY
t.topic_time DESC
LIMIT
0,1';
Dit kan natuurlijk netter, maar dit werkt voorlopig.
