diff --git a/ChangeLog b/ChangeLog index d0c1a4944..826a39a5c 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-09-12 Marc Delisle + * libraries/display_tbl.lib.php3: bug 601809: when two fields have the + same name, both are showed NULL even if only one is NULL + 2002-09-12 Alexander M. Turek * lang/italian-*.inc.php3: Updates, thanks again to Pietro Danesi (danone). diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index eedd4c416..860cf775f 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -1000,9 +1000,20 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // depend on whether the "is_null" php4 function is // available or not $pointer = (function_exists('is_null') ? $i : $meta->name); - if ($meta->numeric == 1) { - if (!isset($row[$meta->name]) + + // lem9: if two fields have the same name (this is possible + // with self-join queries, for example), using $meta->name + // will show both fields NULL even if only one is NULL, + // so use the $pointer + // (works only if function_exists('is_null') + // PS: why not always work with the number ($i), since + // the default second parameter of + // mysql_fetch_array() is MYSQL_BOTH, so we always get + // associative and numeric indices? + + //if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { @@ -1050,7 +1061,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ if (eregi('BINARY', $field_flags)) { $vertical_display['data'][$row_no][$i] = ' [BLOB]' . "\n"; } else { - if (!isset($row[$meta->name]) + //if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { @@ -1068,7 +1080,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ } } } else { - if (!isset($row[$meta->name]) + //if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') {