Changes for central PMA_db: external Links will be shown in tbl_printview again

This commit is contained in:
Mike Beck
2002-06-15 10:52:55 +00:00
parent 3fcfbde887
commit e5221b6cd3

View File

@@ -9,7 +9,9 @@ if (!isset($selected_tbl)) {
include('./libraries/grab_globals.lib.php3'); include('./libraries/grab_globals.lib.php3');
include('./header.inc.php3'); include('./header.inc.php3');
} }
require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam();
/** /**
* Defines the url to return to in case of error in a sql statement * Defines the url to return to in case of error in a sql statement
@@ -135,24 +137,12 @@ while (list($key, $table) = each($the_tables)) {
$fields_cnt = mysql_num_rows($result); $fields_cnt = mysql_num_rows($result);
// check if we can use Relations (Mike Beck) // check if we can use Relations (Mike Beck)
$have_rel = FALSE;
if ($cfg['Server']['relation']) { if ( $cfgRelation['relation']) {
$tables = @PMA_mysql_query('SELECT COUNT(*) AS count FROM ' . PMA_backquote($cfg['Server']['relation']));
$have_rel = ($tables) ? PMA_mysql_result($tables, 0, 'count') : FALSE;
} // end if
if ($have_rel) {
// Find which tables are related with the current one and write it in // Find which tables are related with the current one and write it in
// an array // an array
$rel_query = 'SELECT master_field, concat(foreign_table, \'->\', foreign_field) AS rel ' $res_rel = getForeigners($db,$table);
. ' FROM ' . PMA_backquote($cfg['Server']['relation'])
. ' WHERE master_table = \'' . urldecode($table) .'\'';
$relations = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url);
$res_rel = array();
while ($relrow = @PMA_mysql_fetch_array($relations)) {
$col = $relrow['master_field'];
$res_rel[$col] = $relrow['rel'];
}
if (count($res_rel) > 0) { if (count($res_rel) > 0) {
$have_rel = TRUE; $have_rel = TRUE;
} else { } else {
@@ -255,7 +245,7 @@ while (list($key, $table) = each($the_tables)) {
if ($have_rel) { if ($have_rel) {
echo '<td bgcolor="' . $bgcolor . '" nowrap="nowrap">'; echo '<td bgcolor="' . $bgcolor . '" nowrap="nowrap">';
if (isset($res_rel[$field_name])) { if (isset($res_rel[$field_name])) {
echo htmlspecialchars($res_rel[$field_name]); echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . '->' . $res_rel[$field_name]['foreign_field'] );
} }
echo '&nbsp;</td>'; echo '&nbsp;</td>';
} }