diff --git a/ChangeLog b/ChangeLog index 726a6bfe8..b3665290d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-06-27 Michal Cihar + * libraries/display_tbl.lib.php3, libraries/relation.lib.php3: Added some + checks to avoid trying to use relations when no table (bug #761835). + 2003-06-27 Marc Delisle * sql.php3: bug 760648: incorrect result count on MySQL 3 diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index 3a9c450bb..9ce1907ae 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -1625,15 +1625,19 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { $tabs = '(\'' . join('\',\'', $target) . '\')'; if ($cfgRelation['displaywork']) { - $exist_rel = PMA_getForeigners($db, $table, '', 'both'); - if ($exist_rel) { - while (list($master_field,$rel) = each($exist_rel)) { - $display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']); - $map[$master_field] = array($rel['foreign_table'], - $rel['foreign_field'], - $display_field, - $rel['foreign_db']); - } // end while + if (empty($table)) { + $exist_rel = FALSE; + } else { + $exist_rel = PMA_getForeigners($db, $table, '', 'both'); + if ($exist_rel) { + while (list($master_field,$rel) = each($exist_rel)) { + $display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']); + $map[$master_field] = array($rel['foreign_table'], + $rel['foreign_field'], + $display_field, + $rel['foreign_db']); + } // end while + } // end if } // end if } // end if // end 2b diff --git a/libraries/relation.lib.php3 b/libraries/relation.lib.php3 index 5c40b4f40..92c2524db 100644 --- a/libraries/relation.lib.php3 +++ b/libraries/relation.lib.php3 @@ -305,7 +305,7 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){ } // end while } - if ($source == 'both' || $source == 'innodb') { + if (($source == 'both' || $source == 'innodb') && !empty($table)) { $show_create_table_query = 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table); $show_create_table_res = PMA_mysql_query($show_create_table_query);