Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-list_email_max_rec.php
index 0dc271e48c99f097bd41814df0428af8b3ac1174..676ce93bba8c249ca5c768395d6ee670172f852d 100644 (file)
@@ -16,7 +16,7 @@
  * $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 *
@@ -50,11 +50,11 @@ if (!isPostRequestElementSet('max')) {
 
 if (isPostRequestElementSet('add_max')) {
        // Save all settings
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value='%s' LIMIT 1",
+       $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE value='%s' LIMIT 1",
        array(bigintval(postRequestElement('max'))), __FILE__, __LINE__);
-       if (SQL_HASZERONUMS($result)) {
+       if (ifSqlHasZeroNumRows($result)) {
                // Add this value (including comment)
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (`value`, `comment`) VALUES ('%s','%s')",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_max_receive` (`value`, `comment`) VALUES ('%s','%s')",
                array(bigintval(postRequestElement('max')), postRequestElement('comment')),__FILE__, __LINE__);
                $content = '{--ADMIN_MAX_VALUE_SAVED--}';
        } else {
@@ -63,7 +63,7 @@ if (isPostRequestElementSet('add_max')) {
        }
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Display message
        displayMessage($content);
@@ -76,7 +76,7 @@ if (isPostRequestElementSet('add_max')) {
 
                switch (getRequestElement('do')) {
                        case 'edit': // Change entries
-                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
+                               sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_max_receive` SET value='%s', comment='%s' WHERE `id`=%s LIMIT 1",
                                array(
                                        bigintval(postRequestElement('val', $id)),
                                        postRequestElement('comm', $id),
@@ -86,7 +86,7 @@ if (isPostRequestElementSet('add_max')) {
                                break;
 
                        case 'delete':
-                               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
+                               sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
                                        array($id), __FILE__, __LINE__);
                                $TEXT = '{--ADMIN_MAX_RECEIVE_DELETED--}';
                                break;
@@ -102,10 +102,10 @@ if (isPostRequestElementSet('add_max')) {
        $OUT = '';
        foreach (postRequestElement('sel') as $id => $value) {
                // Load data
-               $result = SQL_QUERY_ESC("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
+               $result = sqlQueryEscaped("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
                        array(bigintval($id)), __FILE__, __LINE__);
-               $content = SQL_FETCHARRAY($result);
-               SQL_FREERESULT($result);
+               $content = sqlFetchArray($result);
+               sqlFreeResult($result);
 
                // Load row template and switch color
                $OUT .= loadTemplate('admin_delete_email_max_rec_row', TRUE, $content);
@@ -119,10 +119,10 @@ if (isPostRequestElementSet('add_max')) {
        $OUT = '';
        foreach (postRequestElement('sel') as $id => $value) {
                // Load data
-               $result = SQL_QUERY_ESC("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
+               $result = sqlQueryEscaped("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `id`=%s LIMIT 1",
                        array(bigintval($id)), __FILE__, __LINE__);
-               $content = SQL_FETCHARRAY($result);
-               SQL_FREERESULT($result);
+               $content = sqlFetchArray($result);
+               sqlFreeResult($result);
 
                // Load row template and switch color
                $OUT .= loadTemplate('admin_edit_email_max_rec_row', TRUE, $content);
@@ -132,18 +132,18 @@ if (isPostRequestElementSet('add_max')) {
        // Load main template
        loadTemplate('admin_edit_email_max_rec', FALSE, $content);
 } else {
-       $result = SQL_QUERY("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
+       $result = sqlQuery("SELECT `id`, `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC",
        __FILE__, __LINE__);
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNumRows($result)) {
                // List already existing entries for editing
                $OUT = '';
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Load row template and switch color
                        $OUT .= loadTemplate('admin_list_email_max_rec_row', TRUE, $content);
                } // END - while
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
                $content['rows'] = $OUT;
 
                // Load main template