]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-categories.php
Syntax errors fixed, naming convention applied, wrappers used:
[mailer.git] / inc / modules / member / what-categories.php
index ce92c895308e3f28bba80909d9ca3d27a11e02ac..1117465b0d19fed15510dee85f5e03a2118e865c 100644 (file)
@@ -50,10 +50,13 @@ addMenuDescription('member', __FILE__);
 $whereStatement = " WHERE `visible`='Y'";
 if (isAdmin()) $whereStatement = '';
 
-$result = SQL_QUERY("SELECT id, cat FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort`", __FILE__, __LINE__);
-$cats = SQL_NUMROWS($result);
+// Get all categories
+$result = SQL_QUERY("SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort` ASC", __FILE__, __LINE__);
 
-if ($cats > 0) {
+// Get num rows
+$numCategories = SQL_NUMROWS($result);
+
+if ($numCategories > 0) {
        $LEAST = false;
        if (isFormSent()) {
                $cnt = '0';
@@ -61,7 +64,7 @@ if ($cats > 0) {
                        if ($joined != 'Y') $cnt++;
                } // END - foreach
 
-               if (($cats - $cnt) < getConfig('least_cats')) {
+               if (($numCategories - $cnt) < getConfig('least_cats')) {
                        unsetPostRequestParameter('ok');
                        $LEAST = true;
                } // END - if
@@ -120,7 +123,7 @@ if ($cats > 0) {
                } // END - if
 
                // Put some data into constants for the template
-               $content['rows'] = ($cats*2+4);
+               $content['rows'] = ($numCategories * 2 + 4);
 
                // Load header template
                loadTemplate('member_cats_header', false, $content);