2009-12-19, 10:18 AM
First, let's give you my situation. The board is a forumotion board, converted with a crawler converter to phpBB, then merged to MyBB. I think this may cause some of the problems, but I don't know. xD
Anyway, I wrote a script to update the postcounts, as they were all at 0.
But now when users post, there is no change in the post count. :/ Could anyone tell me what isn't working?
Thank you very much,
Arianna
Anyway, I wrote a script to update the postcounts, as they were all at 0.
<?php
$dbhost = 'localhost'; // the hostname. is usually 'localhost'.
$dbuser = 'my_dbuser'; // the database. here it always starts with 'pixelpup_'.
$dbpass = 'nottelling'; // the password for it
$dbname = 'my_dbname'; // the user and database are the same... i presume.
$con = mysql_connect($dbhost,$dbuser,$dbpass) or die('Unable to connect');
mysql_select_db($dbname) or die('Unable to select database');
$query = "SELECT * FROM mybb_users";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
while ($i<$num) {
$uid=@mysql_result($result,$i,"uid");
$username=@mysql_result($result,$i,"username");
$query2 = "SELECT * FROM mybb_posts WHERE username='".$username."'";
$result2 = mysql_query($query2);
$postsfound = mysql_numrows($result2);
$query3 = "UPDATE mybb_users SET postnum='".$postsfound."' WHERE uid='".$uid."'";
mysql_query($query3);
echo "Set posts to ".$postsfound." where user is ".$username.".<br>";
$i++;
}
?>
This works, as the one in the admincp doesn't, at all.But now when users post, there is no change in the post count. :/ Could anyone tell me what isn't working?
Thank you very much,
Arianna