Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / filter / earning_filter.php
index 4f290e7..a658857 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -50,36 +50,36 @@ function FILTER_ADD_EARNING_GROUP_POPUP ($filterData) {
        } // END - if
 
        // Now check if the user has subscription and amount left
        } // END - if
 
        // Now check if the user has subscription and amount left
-       $result = SQL_QUERY_ESC("SELECT
-       d.`earning_id`,
-       d.`earning_provider`,
-       u.`earning_current_amount`,
-       u.`earning_daily_amount`,
-       u.`earning_active`,
-       u.`earning_added`,
-       u.`earning_canceled`,
-       u.`earning_points`
+       $result = sqlQueryEscaped("SELECT
+       `d`.`earning_id`,
+       `d`.`earning_provider`,
+       `u`.`earning_current_amount`,
+       `u`.`earning_daily_amount`,
+       `u`.`earning_active`,
+       `u`.`earning_added`,
+       `u`.`earning_canceled`,
+       `u`.`earning_points`
 FROM
 FROM
-       `{?_MYSQL_PREFIX?}_user_earning` AS u
+       `{?_MYSQL_PREFIX?}_user_earning` AS `u`
 INNER JOIN
 INNER JOIN
-       `{?_MYSQL_PREFIX?}_earning_data` AS d
+       `{?_MYSQL_PREFIX?}_earning_data` AS `d`
 ON
 ON
-       u.`earning_id`=d.`earning_id`
+       `u`.`earning_id`=`d`.`earning_id`
 WHERE
 WHERE
-       u.`earning_userid`=%s AND
-       u.`earning_active`='Y' AND
-       u.`earning_current_amount` < u.`earning_daily_amount` AND
-       d.`earning_group`='POPUP'
+       `u`.`earning_userid`=%s AND
+       `u`.`earning_active`='Y' AND
+       `u`.`earning_current_amount` < `u`.`earning_daily_amount` AND
+       `d`.`earning_group`='POPUP'
 ORDER BY
 ORDER BY
-       d.`earning_sorting` ASC",
+       `d`.`earning_sorting` ASC",
                array(
                        getMemberId()
                ), __FUNCTION__, __LINE__);
 
                array(
                        getMemberId()
                ), __FUNCTION__, __LINE__);
 
-       // Do we have entries left?
-       if (!SQL_HASZERONUMS($result)) {
+       // Are there entries left?
+       if (!ifSqlHasZeroNumRows($result)) {
                // Load all names
                // Load all names
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Merge the $filterData array in
                        $content = merge_array($content, $filterData);
 
                        // Merge the $filterData array in
                        $content = merge_array($content, $filterData);
 
@@ -96,7 +96,7 @@ ORDER BY
        } // END - if
 
        // Free result
        } // END - if
 
        // Free result
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Return filter data
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
 
        // Return filter data
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');