Missing column 'active_bonus' fixed, some while() loops rewritten
[mailer.git] / inc / monthly / monthly_bonus.php
index 281c08a0438e3fbe2abe79cce500cc5fe08dec50..1ac1f05ea0fc25136d7048d42bf51dee516daa34 100644 (file)
@@ -78,7 +78,8 @@ if (($curr != $_CONFIG['last_month']) && ($_CONFIG['bonus_ranks'] > 0) && ($CSS
        $result_main = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, (0".$ADD.") AS points
 FROM "._MYSQL_PREFIX."_user_data
 ".$whereStatement1."".$ADD."
-ORDER BY active_bonus DESC, userid LIMIT %s",
+ORDER BY points DESC, userid
+LIMIT %s",
                array($whereStatement2), __FILE__, __LINE__);
 
        // Some entries were found?
@@ -91,7 +92,7 @@ ORDER BY active_bonus DESC, userid LIMIT %s",
                                ADD_POINTS_REFSYSTEM("monthly_bonus", $content['uid'], $content['points'], false, "0", false, "direct");
 
                                // Translate gender/points
-                               $content['gender'] = TRANSLATE_GENDER($content['gender']);
+                               $content['gender']       = TRANSLATE_GENDER($content['gender']);
                                $content['points'] = TRANSLATE_COMMA($content['points']);
 
                                // Load email template and email it away