DJP1986 Posted March 25, 2008 Share Posted March 25, 2008 Hello all! I want to set my home page up to grab data from a thread in my vBulletin forum and have it immediately export the data onto the home page. Basically, when someone posts a new thread in a specified forum, all of the text they post in the thread will posted onto the home page. In order to show what I mean, I can redirect you to this site: http://www.hellandheavennet.com See how there are tables that have news posts, with links to comments? I want to do something like this. Now look at this link: http://forums.hellandheavennet.com/forumdisplay.php?f=43 That second link is the sub-forum that the users post the threads in and the threads show up on the home page. I don't want the thread title or anything, I want the actual post. Does anyone know how to do this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/97851-pulling-content-from-a-thread-to-put-on-website/ Share on other sites More sharing options...
MadTechie Posted March 25, 2008 Share Posted March 25, 2008 read the code for the forum and use the same sql query , or just look at the database table and create a query to do it! Quote Link to comment https://forums.phpfreaks.com/topic/97851-pulling-content-from-a-thread-to-put-on-website/#findComment-500665 Share on other sites More sharing options...
DJP1986 Posted March 25, 2008 Author Share Posted March 25, 2008 I tried to follow that and copied the code, but I wound up getting this SQL error: Database error in vBulletin 3.6.8: Invalid SQL: SELECT IF(votenum >= 1, votenum, 0) AS numbvote, IF(votenum >= 1 AND votenum != 0, votetotal / votenum, 0) AS voteavg, editlog.dateline AS edit_dateline, thread.threadid, post.title, thread.replycount, postusername, postuserid, threadprefix, thread.dateline AS postdateline, thread.lastposter, thread.lastpost, IF(views<=thread.replycount, thread.replycount+1, views) AS views, thread.forumid, post.postid, pagetext, allowsmilie, thread.iconid AS threadiconid, iconpath AS threadiconpath, avatarpath, NOT ISNULL(filedata) AS hascustom, customavatar.dateline AS avatardateline, avatarrevision, NOT ISNULL(subscribethread.subscribethreadid) AS subscribed FROM thread AS thread LEFT JOIN post AS post ON (post.postid = thread.firstpostid) LEFT JOIN postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = -1 AND postparsed.languageid = -1) LEFT JOIN editlog AS editlog ON(editlog.postid = post.postid) LEFT JOIN icon AS icon ON (icon.iconid = thread.iconid) LEFT JOIN user AS user ON (user.userid = post.userid) LEFT JOIN avatar as avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN customavatar AS customavatar ON (customavatar.userid = user.userid) LEFT JOIN subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = '2') WHERE thread.forumid IN(4) GROUP BY post.postid ORDER BY thread.dateline DESC LIMIT 10; MySQL Error : Unknown column 'threadprefix' in 'field list' Error number: 1054 I'm not sure, but I think I may have messed up the column threadprefix. Do you know what I'm doing wrong by any chance? Quote Link to comment https://forums.phpfreaks.com/topic/97851-pulling-content-from-a-thread-to-put-on-website/#findComment-500789 Share on other sites More sharing options...
MadTechie Posted March 26, 2008 Share Posted March 26, 2008 i would probably trim it down to something like this SELECT thread.threadid, post.title, thread.replycount, threadprefix, thread.dateline AS postdateline, thread.forumid, post.postid, pagetext, allowsmilie, thread.iconid AS threadiconid, FROM thread AS thread LEFT JOIN post AS post ON (post.postid = thread.firstpostid) LEFT JOIN postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = -1 AND postparsed.languageid = -1) WHERE thread.forumid IN(4) GROUP BY post.postid ORDER BY thread.dateline DESC LIMIT 10; of course with out knowing the database setup this is more guess work! you can probably trim this down to 1 table (maybe with 1 join) Quote Link to comment https://forums.phpfreaks.com/topic/97851-pulling-content-from-a-thread-to-put-on-website/#findComment-500848 Share on other sites More sharing options...
teng84 Posted March 26, 2008 Share Posted March 26, 2008 oh wait you use alias in the wrong way i guess LEFT JOIN postparsed AS postparsed use less id say Quote Link to comment https://forums.phpfreaks.com/topic/97851-pulling-content-from-a-thread-to-put-on-website/#findComment-500851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.