2012-09-08 49 views
0
$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代碼的一部分,用於顯示外部電影頁面上論壇主題的帖子內容。如何在MySQL上獲得vBulletin線程ID?

假設我正在查看AVATAR電影頁面。它是自動檢查論壇(只有電影評論論壇是id(12))如果有任何主題標題包含「頭像」字。如果是,則顯示電影頁面中的帖子發佈內容。

因爲我想給這個線程的鏈接,我也需要知道線程標題。

此時我需要幫助。我怎樣才能獲得該論壇帖子的ID,這樣我就可以添加一個鏈接HTML模板,如:

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

在此先感謝... 問候

回答

0

你能解釋一下嗎?

它似乎是答案在你的問題!

線程在VB中的URL

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

,所以你可以將其指定爲變量,然後把它像你一樣:

$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>