]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_sponsor.php
More usage of EL
[mailer.git] / inc / modules / admin / what-list_sponsor.php
index b0f0cf593da892747d5238d90b9ee4047a13c101..864e6fe6fdbdd50371159856e85019ba915c6d2c 100644 (file)
@@ -61,11 +61,10 @@ WHERE
        if (SQL_NUMROWS($result) == 1) {
                // Load sponsor details
                $content = SQL_FETCHARRAY($result);
-               SQL_FREERESULT($result);
 
                // Check if an entry is empty
                foreach ($content as $k => $v) {
-                       if (empty($v)) $content[$k] = '---';
+                       if ((empty($v)) && ($v != 0)) $content[$k] = '---';
                } // END - foreach
 
                // Prepare all data for the template
@@ -78,7 +77,7 @@ WHERE
                $content['last_online']     = generateDateTime($content['last_online'], 2);
                $content['last_change']     = generateDateTime($content['last_change'], 2);
                //  Orders total
-               $content['orders']          = countSumTotalData(bigintval(getRequestParameter('id')), 'sponsor_orders', 'id', 'sponsorid', true);
+               $content['orders']          = countSumTotalData(bigintval(getRequestParameter('id')), 'sponsor_orders', 'id', 'sponsor_id', true);
 
                // Load template
                loadTemplate('admin_list_sponsor_details', false, $content);
@@ -86,9 +85,12 @@ WHERE
                // Sponsor not found
                loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_404', bigintval(getRequestParameter('id'))));
        }
+
+       // Free result
+       SQL_FREERESULT($result);
 } elseif (isGetRequestParameterSet('refid')) {
        // Search for sponsor
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `id`='%s' LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `id`=%s LIMIT 1",
                array(bigintval(getRequestParameter('refid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Free memory
@@ -134,18 +136,10 @@ ORDER BY
                $OUT = '';
                while ($content = SQL_FETCHARRAY($result_main)) {
                        // Transfer data to array
-                       $content = array(
-                               'id'              => $content['id'],
-                               'gender'          => $content['gender'],
-                               'surname'         => $content['surname'],
-                               'family'          => $content['family'],
-                               'email'           => generateEmailLink($content['email'], 'sponsor_data'),
-                               'status'          => $content['status'],
-                               'sponsor_created' => generateDateTime($content['sponsor_created'], 2),
-                               'last_online'     => generateDateTime($content['last_online'], 2),
-                               'points'          => ($content['points_amount'] - $content['points_used']),
-                               'remote_addr'     => $content['remote_addr'],
-                       );
+                       $content['email']           = generateEmailLink($content['email'], 'sponsor_data');
+                       $content['sponsor_created'] = generateDateTime($content['sponsor_created'], 2);
+                       $content['last_online']     = generateDateTime($content['last_online'], 2);
+                       $content['points']          = ($content['points_amount'] - $content['points_used']);
 
                        // Load row template
                        $OUT .= loadTemplate('admin_list_sponsor_row', true, $content);