- $result = SQL_QUERY_ESC("SELECT s.id, s.userid, s.pool_id, t.price
-FROM `{!_MYSQL_PREFIX!}_user_stats` AS s
-LEFT JOIN `{!_MYSQL_PREFIX!}_payments` AS t
-ON s.payment_id=t.id
-WHERE s.timestamp_ordered <= (UNIX_TIMESTAMP() - %s) ORDER BY s.userid",
- array(bigintval($PURGE)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0) {
+ $result = SQL_QUERY('SELECT
+ s.id, s.userid, s.pool_id, t.price
+FROM
+ `{?_MYSQL_PREFIX?}_user_stats` AS s
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_payments` AS t
+ON
+ s.payment_id=t.id
+WHERE
+ s.timestamp_ordered <= (UNIX_TIMESTAMP() - {?auto_purge?})
+ORDER BY
+ s.userid ASC', __FILE__, __LINE__);
+ if (!SQL_HASZERONUMS($result)) {