AmaZed
08-06-2001, 12:07 PM
I am just wondering how would I go about creating a new thread? I have scanned through the forum code a bit, but really didnt find to much where he created a new thread..
I am writing a news script, and i want to add an option 'create new thread' and it will take all the info I have for my news script and basicly create a new thread with the info givin from the news script.
If i sound fuxed up..ive been up all night codin my site..
/me will edit this for sure later
Scott MacVicar
08-06-2001, 01:09 PM
I presume you mean the query to add a post
you need to do 3 queries
one to write to thread
one to write to post
and one to write to forum to update the latest post
//Create Thread
mysql_query("INSERT INTO thread (threadid, title, lastpost, forumid, pollid, open, replycount, postusername, postuserid, lastposter, dateline, views, iconid, notes, visible, sticky, votenum, votetotal, attach) VALUES ('', '" . addslashes([SUBJECT]) . "', '[UNIX TIME]', '[FORUM ID]', '0', '1', '0', '[USERNAME]', '[USERID]', '[USERNAME]', '[UNIX TIME]', '1', '1', '', '1', '0','0', '0', '0')");
//Create Posting
mysql_query("INSERT INTO post (postid, threadid, username, userid, title, dateline, attachmentid, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible, edituserid, editdate) VALUES ('', '[THREADID]', '[USERNAME]', '[USERID]', '" . addslashes([SUBJECT]) . "', '[UNIX TIME]', '0', '" . addslashes(ALL TEXT) . "', '1', '0', '127.0.0.1', '1', '1', '0', '0')");
//Update Forum Info
mysql_query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='[UNIX TIME]',lastposter='" . addslashes([USERNAME]) . "' WHERE forumid='[FORUMID]'");
[UNIX TIME] <= time in seconds after 1970
[SUBJECT] <= Post Subject
[FORUMID] <= ID of forum this one is number 8
[USERNAME] <= Name as it will appear in post
[USERID] <= User ID of the person posting yours is 7197
[THREADID] <= ID of the thread post is associated with
[ALL TEXT] <= stuff to be in post
thats pretty much everything, if you have any more problems I will help.
AmaZed
08-06-2001, 02:40 PM
thanks! just what i needed
Scott MacVicar
08-06-2001, 03:51 PM
Yeah no problem
I already done a comment system for nPHP v215
suggestion though, when they edit the news post, they edit the thread.
If they delete the news post, they delete the thread.
:)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.