X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmodules%2Fadmin%2Fwhat-send_coupon.php;h=cbb5d8a1ca8b604f91e1ba3d384b3ede8c1985ca;hb=f2b603aed42bfdf7a94611d7bae71fe3a1048890;hp=4ce955c1afe428327c5dc9bb51b7358c71b8b017;hpb=cd7d344ea7007cfa20413acd3e03e50f0ab86d86;p=mailer.git diff --git a/inc/modules/admin/what-send_coupon.php b/inc/modules/admin/what-send_coupon.php index 4ce955c1af..cbb5d8a1ca 100644 --- a/inc/modules/admin/what-send_coupon.php +++ b/inc/modules/admin/what-send_coupon.php @@ -54,7 +54,7 @@ if (isFormSent()) { displayMessage('{--ADMIN_SEND_COUPON_DESCRIPTION_NOT_ENTERED--}'); } else { // All fields are set, so we can start looking for users who wants to receive coupons - $result = SQL_QUERY("SELECT + $result = sqlQuery("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` @@ -67,30 +67,30 @@ ORDER BY __FILE__, __LINE__); // Are there entries left? - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNums($result)) { // Convert timestamp selections $expirationTime = time() + createEpocheTimeFromSelections('coupon_default_time', postRequestArray()); // Insert coupon data - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_coupon_data` (`coupon_expired`, `total_created`, `points`, `coupon_description`) VALUES ('{%%pipe,SQL_EPOCHE_TO_TIMESTAMP=%s%%}', %s,%s,'%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_coupon_data` (`coupon_expired`, `total_created`, `points`, `coupon_description`) VALUES ('{%%pipe,SQL_EPOCHE_TO_TIMESTAMP=%s%%}', %s,%s,'%s')", array( $expirationTime, - SQL_NUMROWS($result), + sqlNumRows($result), bigintval(postRequestElement('points')), postRequestElement('coupon_description') ), __FILE__, __LINE__ ); // Get the insert id from the table - $couponId = SQL_INSERT_ID(); + $couponId = getSqlInsertId(); // Init userid array $adminUserids = array(); // Load entry - while (list($userid) = SQL_FETCHROW($result)) { + while (list($userid) = sqlFetchRow($result)) { // Debug message - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'NUMS=' . SQL_NUMROWS($result) . ',userid=' . $userid); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'NUMS=' . sqlNumRows($result) . ',userid=' . $userid); // By default no code is unique $isUnique = FALSE; @@ -110,7 +110,7 @@ ORDER BY } // END - while // The above loop should always set $couponCode, so we can now insert it - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_coupons` (`coupon_id`, `userid`, `coupon_code`) VALUES (%s,%s,'%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_coupons` (`coupon_id`, `userid`, `coupon_code`) VALUES (%s,%s,'%s')", array( $couponId, $userid, @@ -157,7 +157,7 @@ ORDER BY } // Free result - SQL_FREERESULT($result); + sqlFreeResult($result); } } else { // Prepare some template data