update the forum/postcounter
MOD Information
The Developer
|
|
|
Version: , by Wildthinks
Developer Last Online: Sep 2013
| Version: Unknown |
Rating:
|
| Released: 03-07-2003 |
Last Update: Never |
Installs: 0 |
|
|
|
|
No support by the author. |
Hi,
it's wrong board plz move to the right THX.
I use the follow function to post in my forum, but the problem is, that the counter not be updated. I cant understand whyy...please helpt (posting is ok, but reply is wrong) based on a post on this board :-)
PHP Code:
function replytoallsearchtext($subject,$message,$searchstring,$searchfield="pagetext", $tbl="post",$iconid="1",$signature="1",$postusername="::uploadbot::",$userid="4108")
{
global $conn;
global $dbpass;
global $dbserver;
global $dbase;
// dearch post to be answer
$sql = "SELECT DISTINCT $searchfield, threadid FROM $tbl where $searchfield like '%$searchstring%' group by threadid";
echo $sql." <br>";
$vb_searchresult = mysql_query($sql,$conn);
echo "<br>Found Count: ".mysql_num_rows($vb_searchresult);
while ( $listlinked=mysql_fetch_array($vb_searchresult))
{
/* Insert values into the POST table */
$sql = "INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$listlinked[threadid]','".addslashes($subject)."','".addslashes($postusername)."','$userid','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconid','1')";
echo "<br> Posten der Nachricht ";
$vb_result = mysql_query($sql,$conn);
$postid = mysql_insert_id();
echo "<br>PostID:".$postid;
//get forumid
$sql="select thread.threadid, thread.forumid from thread where thread.threadid=$listlinked[threadid];";
echo "<br> Forumid holen...";
$forumsearchresult = mysql_query($sql,$conn);
while ( $forumsearch_ID=mysql_fetch_array($forumsearchresult))
{
//Update threadcount
$sql = "SELECT * FROM forum WHERE forumid='$forumsearch_ID[forumid]'";
$forum_query = mysql_query($sql,$conn) or die(mysql_error());
echo "<br> get forum for update counter ";
$forum_row = mysql_fetch_Array($forum_query);
$sql = "UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($forum_row[parentlist])";
echo "<br> Update Counter: ";
$vb_result = mysql_query($sql,$conn);
}
}
}
THX....
Show Your Support
-
If you like to thanks you by the author -> Click Thanks to the Author
- This modification may not be copied, reproduced or published elsewhere without author's permission.
|