Killa878
07-02-2011, 05:52 PM
Hello all,
im trying to create a PHP Function that will add a thread to the forums.
This is what i got must its not working:
private function MakeThread( $ForumId, $Title, $Content )
{
mysql_query( "INSERT INTO `thread` (`threadid`,`title`,`prefixid`,`firstpostid`,`last postid`,`lastpost`,`forumid`,`pollid`,`open`,`repl ycount`,`hiddencount`,`deletedcount`,`postusername `,`postuserid`,`lastposter`,`dateline`,`lastedit`, `views`,`iconid`,`notes`,`visible`,`sticky`,`voten um`,`votetotal`,`attach`,`similar`,`taglist`,`vbse o_linkbacks_no`,`lastposterid`,`keywords`,`wrdate` ) VALUES (NULL, '". mysql_real_escape_string($Title) ."', '', '0', '0', '". $ForumId ."', '0', '0', '0', '0', '0', '". $this->UserData['username'] ."', '". $this->UserData['userid'] ."', '". $this->UserData['username'] ."', '". SCRIPT_TIME ."', '0', '0', '', '0', '', '1', '0', '0', '0', '0', '0', '0', '". $this->UserData['userid'] ."', '0', '0')" ) or die( "Q1: " . mysql_error( ) );
// Get the inserted thread ID
$ThreadID = mysql_insert_id( );
mysql_query( "INSERT INTO 'post` (`postid`,`threadid`,`parentid`,`username`,`userid `,`title`,`dateline`,`lastedit`,`pagetext`,`allows milie`,`showsignature`,`ipaddress`,`iconid`,`visib le`,`attach`,`infraction`,`reportthreadid`,`htmlst ate`) VALUES (NULL, '". $ThreadID ."', '0', '". $this->UserData['username'] ."', '". $this->UserData['userid'] ."', '', '". SCRIPT_TIME ."', '', '" . $Content . "', '0', '0', '". $this->UserIP ."', '0', '1', '0', '0', '0', 'on_nl2br')" ) or die( "Q2: " . mysql_error( ) );
$PostID = mysql_insert_id( );
mysql_query( "UPDATE `thread` SET `firstpostid` = " . $PostID . ", `lastpostid` = " . $PostID . " WHERE `threadid` = " . $ThreadID . " LIMIT 1" );
}
All the vars such as UserData and Username is ok. As they are stored within the class.
At this point no thread is being made.
Thanks
im trying to create a PHP Function that will add a thread to the forums.
This is what i got must its not working:
private function MakeThread( $ForumId, $Title, $Content )
{
mysql_query( "INSERT INTO `thread` (`threadid`,`title`,`prefixid`,`firstpostid`,`last postid`,`lastpost`,`forumid`,`pollid`,`open`,`repl ycount`,`hiddencount`,`deletedcount`,`postusername `,`postuserid`,`lastposter`,`dateline`,`lastedit`, `views`,`iconid`,`notes`,`visible`,`sticky`,`voten um`,`votetotal`,`attach`,`similar`,`taglist`,`vbse o_linkbacks_no`,`lastposterid`,`keywords`,`wrdate` ) VALUES (NULL, '". mysql_real_escape_string($Title) ."', '', '0', '0', '". $ForumId ."', '0', '0', '0', '0', '0', '". $this->UserData['username'] ."', '". $this->UserData['userid'] ."', '". $this->UserData['username'] ."', '". SCRIPT_TIME ."', '0', '0', '', '0', '', '1', '0', '0', '0', '0', '0', '0', '". $this->UserData['userid'] ."', '0', '0')" ) or die( "Q1: " . mysql_error( ) );
// Get the inserted thread ID
$ThreadID = mysql_insert_id( );
mysql_query( "INSERT INTO 'post` (`postid`,`threadid`,`parentid`,`username`,`userid `,`title`,`dateline`,`lastedit`,`pagetext`,`allows milie`,`showsignature`,`ipaddress`,`iconid`,`visib le`,`attach`,`infraction`,`reportthreadid`,`htmlst ate`) VALUES (NULL, '". $ThreadID ."', '0', '". $this->UserData['username'] ."', '". $this->UserData['userid'] ."', '', '". SCRIPT_TIME ."', '', '" . $Content . "', '0', '0', '". $this->UserIP ."', '0', '1', '0', '0', '0', 'on_nl2br')" ) or die( "Q2: " . mysql_error( ) );
$PostID = mysql_insert_id( );
mysql_query( "UPDATE `thread` SET `firstpostid` = " . $PostID . ", `lastpostid` = " . $PostID . " WHERE `threadid` = " . $ThreadID . " LIMIT 1" );
}
All the vars such as UserData and Username is ok. As they are stored within the class.
At this point no thread is being made.
Thanks