$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",
+ $result = SQL_QUERY_ESC("SELECT `id`, `code`, `descr` FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
- list($code, $descr) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Prepare data, load row template and switch colors
- $content = array(
- 'id' => $id,
- 'code' => $code,
- 'descr' => $descr,
- );
+ $content = SQL_FETCHARRAY($result);
if ($post == 'modify') {
// Generate default selection in edit-mode
// Insert row template and switch color
$OUT .= loadTemplate($row, true, $content);
} // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
} // END - foreach
// Prepare content for template
// 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 = '';
while ($content = SQL_FETCHARRAY($result)) {