- $result_inactive = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.email, d.last_online
-FROM `"._MYSQL_PREFIX."_user_data` AS d
-WHERE d.status='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s)
-".$EXCLUDE_LIST."
-ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
-
- if (SQL_NUMROWS($result_inactive) > 0) {
+ $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online
+FROM
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+WHERE
+ d.status='CONFIRMED' AND
+ d.joined < (UNIX_TIMESTAMP() - %s) AND
+ d.last_online < (UNIX_TIMESTAMP() - %s) AND
+ d.ap_notified < (UNIX_TIMESTAMP() - %s)
+ ".$EXCLUDE_LIST."
+ORDER BY
+ d.userid ASC",
+ array(
+ getApInactiveSince(),
+ getApInactiveSince(),
+ getApInactiveSince()
+ ), __FILE__, __LINE__);
+
+ if (!SQL_HASZERONUMS($result_inactive)) {