]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-cash_coupon.php
Renamed all SQL-related functions to camel-case notation
[mailer.git] / inc / modules / member / what-cash_coupon.php
index bd690450c856328fbb49c6b7c5f99994fe46ffec..dc1edff917513fbf0c30167bdabd73353eb4e613 100644 (file)
@@ -56,7 +56,7 @@ if (isFormSent()) {
        // Is the coupon code entered?
        if (isPostRequestElementSet('coupon_code')) {
                // Search for the coupon
-               $result = SQL_QUERY_ESC("SELECT
+               $result = sqlQueryEscaped("SELECT
        `c`.`coupon_id`,
        `c`.`userid`,
        `c`.`coupon_code`,
@@ -85,15 +85,15 @@ LIMIT 1",
                        ), __FILE__, __LINE__);
 
                // Is there an entry?
-               if (SQL_NUMROWS($result) == 1) {
+               if (sqlNumRows($result) == 1) {
                        // Load data
-                       $content = SQL_FETCHARRAY($result);
+                       $content = sqlFetchArray($result);
 
                        // Run pre-filter
                        $content = runFilterChain('pre_cash_coupon', $content);
 
                        // Mark it as "cashed"
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_user_coupons`
 SET
        `cashed_on`=NOW(),
@@ -108,17 +108,17 @@ LIMIT 1",
                                ), __FILE__, __LINE__);
 
                        // Does it work?
-                       if (SQL_HASZEROAFFECTED()) {
+                       if (ifSqlHasZeroAffectedRows()) {
                                // Abort it here, it always must work
                                reportBug(__FILE__, __LINE__, 'User coupon cannot be updated! coupon_id=' . $content['coupon_id']);
                        } // END - if
 
                        // Update count as well
-                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_coupon_data` SET `total_cashed`=`total_cashed`+1 WHERE `id`=%s AND `total_cashed` < `total_created` LIMIT 1",
+                       sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_coupon_data` SET `total_cashed`=`total_cashed`+1 WHERE `id`=%s AND `total_cashed` < `total_created` LIMIT 1",
                                array(bigintval($content['coupon_id'])), __FILE__, __LINE__);
 
                        // Does it work?
-                       if (SQL_HASZEROAFFECTED()) {
+                       if (ifSqlHasZeroAffectedRows()) {
                                // Abort it here, it always must work
                                reportBug(__FILE__, __LINE__, 'Coupon data cannot be updated! coupon_id=' . $content['coupon_id']);
                        } // END - if
@@ -134,7 +134,7 @@ LIMIT 1",
                }
 
                // Free the result
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
        } else {
                // No code entered!
                displayMessage('{--MEMBER_COUPON_CODE_EMPTY--}');
@@ -152,11 +152,11 @@ LIMIT 1",
        }
 
        // And change it in the database
-       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `receiving_coupons`='%s' WHERE `userid`=%s LIMIT 1",
+       sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `receiving_coupons`='%s' WHERE `userid`=%s LIMIT 1",
                array($newStatus, getMemberId()), __FILE__, __LINE__);
 
        // Did something change?
-       if (!SQL_HASZEROAFFECTED()) {
+       if (!ifSqlHasZeroAffectedRows()) {
                // Records have been updated
                displayMessage($message);
        } else {