简体   繁体   中英

How can i get vBulletin thread id on MySQL?

$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
");

Above is a part of php code to display the post content from a forum thread on external movie page.

Let's say that am viewing AVATAR movie page. It's automatically checking forum (only movie reviews forum which is id(12) ) if there is any thread title contains "avatar" word. If yes, then it is displaying the thread post content in the movie page.

Since i would like to give a link to that thread, i need to know the thread title too.

At this point i need help. How can i get the forum thread id so i can add a link html template such as :

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

Thanks in advance... Regards

Can you explain more?

it seems that the answer is inside your question !

the URL of threads in vb

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

so you may assign it to var then put it like you do :

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

Then :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM