如何在MySQL上获得vBulletin线程ID?

时间:2012-09-08 23:37:44

标签: php mysql vbulletin

$reviewsthread = $vbulletin->db->query_first("
    SELECT
        thread.threadid, thread.title,
        post.pagetext AS preview
    FROM
        ".TABLE_PREFIX."thread AS thread INNER JOIN
        ".TABLE_PREFIX."post AS post ON thread.firstpostid = post.postid
    WHERE
        thread.forumid = 12
        AND
        thread.title LIKE '%".$vbulletin->db->escape_string($moviedata['title'])."%'
    LIMIT
        1
");

上面是php代码的一部分,用于显示外部电影页面上论坛帖子的帖子内容。

让我们说正在观看AVATAR电影页面。它是自动检查论坛(只有电影评论论坛,这是id(12)),如果有任何主题标题包含“头像”字。如果是,那么它将在电影页面中显示帖子帖子内容。

由于我想提供该主题的链接,我也需要知道主题标题。

此时我需要帮助。我如何获得论坛帖子ID,以便我可以添加链接html模板,例如:

<a href="showthread.php?t=$moviereviewthreadid">Click here to read the entire review...</a>

提前致谢... 此致

1 个答案:

答案 0 :(得分:0)

你能解释一下吗?

似乎答案在你的问题中!

vb中的线程的URL

<a href="SITE URL/showthread.php?t=THREAD ID > title </a>

所以你可以把它分配给var然后像你一样把它放在:

$moviereviewthreadid = $vbulletin->db->query_read("SELECT thread.threadid FROM ".TABLE_PREFIX."thread WHERE forumid = 12 ")

然后:

<a href="showthread.php?t=$moviereviewthreadid">Click here to read the entire review...</a>
相关问题