'; } if($fix_pm_count) { // Number of users.. $result = db_query("SELECT COUNT(ID_MEMBER) FROM {$db_prefix}members", __FILE__, __LINE__); $numberusers = mysql_fetch_row($result); mysql_free_result($result); // Really i is user. $i = 0; // This is just to count how many users we had incorrect instantMessage in profile.. $a = 0; // How many users didn't exist $b = 0; // Big loop. while ($i <= $numberusers) { // Find out how many pms it says they have. $result = db_query("SELECT instantMessages FROM {$db_prefix}members WHERE ID_MEMBER = $i", __FILE__, __LINE__); // Before we put it in a row lets see if it was even able to do that. If it couldn't most likely the user id don't exist. if(!$result) { //update b because it didn't exist. ++$b; echo '
ID_MEMBER ', $i, ' Does not exist'; } else { $numbermsgs = mysql_fetch_row($result); // Find out how much they really have. $resultB = db_query("SELECT COUNT(ID_PM) FROM {$db_prefix}pm_recipients WHERE ID_MEMBER = $i", __FILE__, __LINE__); $realnummsgs = mysql_fetch_row($resultB); mysql_free_result($resultB); // Only Update if it is not correct.. Just to save a few mysql queries. if($realnummsgs != $numbermsgs) { // Update a because they need fixed. ++$a; $result = db_query("UPDATE {$db_prefix}members SET instantMessages = $realnummsgs WHERE ID_MEMBER = $i", __FILE__, __LINE__); mysql_free_result($result); if(!$result) echo '
Unable to update ID_MEMBER ', $i, ' whos instantMessages count Says:', $numbermsgs, ' Should be:', $realnummsgs; else echo '
Updated ID_MEMBER ', $i, ' instantMessages count to correct number ', $realnummsgs; } } mysql_free_result($result); // Now we are done with that user or couldn't find them.. Up i and start again. ++$i; } // We are done so let the user using this know. echo '


', sprintf($lang['done_recount'], $numberusers, $a, $b); } ?>