-// Let's check if there are some points left we can "pay"...
-$result = SQL_QUERY_ESC("SELECT userid, beg_points AS beg, last_online FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE beg_points > 0 AND `status`='CONFIRMED'".$lastOnline."
-ORDER BY beg_points DESC, last_online DESC, userid LIMIT %s",
-array($ONLINE, getConfig('beg_ranks')), __FILE__, __LINE__);
+// Let's check if there are some points left we can 'pay'...
+$result = SQL_QUERY_ESC("SELECT
+ `userid`, `beg_points` AS points, `last_online`
+FROM
+ `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+ `beg_points` > 0 AND
+ `status`='CONFIRMED'
+ " . $lastOnline . "
+ORDER BY
+ `beg_points` DESC,
+ `last_online` DESC,
+ `userid` ASC
+LIMIT {?beg_ranks?}",
+ array(
+ $ONLINE
+ ), __FILE__, __LINE__);