From 63940df8200c7d45d87dce3966986f49ed987942 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Wed, 28 May 2003 12:25:30 +0000 Subject: [PATCH] relational scheme, support request #739752 --- ChangeLog | 3 +++ tbl_relation.php3 | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56c8d635c..6fa907fb9 100755 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ $Source$ to the PEAR call() funktion. * index.php3: Bug #743856. Fixed trinary operator, thanks to Virgile Petit! + * tbl_relation.php3: Will now not show a selected display field, if + none has been set yet for a table to not let users think, the key + is set. 2003-05-26 Michal Cihar * lang/czech: sorted. diff --git a/tbl_relation.php3 b/tbl_relation.php3 index 9c46717c0..a63f8f953 100644 --- a/tbl_relation.php3 +++ b/tbl_relation.php3 @@ -71,11 +71,17 @@ if ($cfgRelation['displaywork'] && isset($submit_show) && $submit_show == 'true') { if ($disp) { - $upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info']) - . ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\'' - . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' - . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; - } else { + if ($display_field != '') { + $upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info']) + . ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\'' + . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' + . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; + } else { + $upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) + . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' + . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; + } + } elseif ($display_field != '') { $upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_info']) . '(db_name, table_name, display_field) ' . ' VALUES(' @@ -255,6 +261,7 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) {