}
// Edit all selected country codes
- $OUT = ''; $SW = 2;
+ $OUT = '';
foreach (postRequestParameter('id') as $id => $status) {
// Load data from DB
$result = SQL_QUERY_ESC("SELECT code, descr FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id`=%s LIMIT 1",
'id' => $id,
'code' => $code,
'descr' => $descr,
- 'sw' => $SW,
);
if ($post == 'modify') {
// Insert row template and switch color
$OUT .= loadTemplate($row, true, $content);
- $SW = 3 - $SW;
- }
- }
+ } // END - if
+ } // END - foreach
// Prepare content for template
$content = array(
// Display message
loadTemplate('admin_settings_saved', false, $message);
- }
+ } // END - if
// Load currenty setup country codes to list
$result = SQL_QUERY('SELECT id, code, descr, is_active FROM `{?_MYSQL_PREFIX?}_countries` ORDER BY code',
__FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// List all countries
- $OUT = ''; $SW = 2;
+ $OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
// Prepare array for the template
$content['active'] = translateYesNo($content['is_active']);
- $content['sw'] = $SW;
// Load row template and switch colors
$OUT .= loadTemplate('admin_list_country_row', true, $content);
- $SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);