code was broken and warnings

This commit is contained in:
Loïc Chapeaux
2002-04-29 19:26:53 +00:00
parent 6d13e69134
commit 4465f15544

View File

@@ -1,6 +1,7 @@
<?php <?php
/* $Id$ */ /* $Id$ */
/** /**
* Gets the values of the variables posted or sent to this script and displays * Gets the values of the variables posted or sent to this script and displays
* the headers * the headers
@@ -728,7 +729,7 @@ if (isset($Field) && count($Field) > 0) {
$wtable = explode('.', urldecode($Field[$x])); $wtable = explode('.', urldecode($Field[$x]));
$ctable = str_replace('`', '', $wtable[0]); $ctable = str_replace('`', '', $wtable[0]);
if (!empty($Field[$x]) && !empty($Criteria[$x])) { if (!empty($Field[$x]) && !empty($Criteria[$x])) {
if ($where[$ctable] != '=') { if (isset($where[$ctable]) && $where[$ctable] != '=') {
$where[$ctable] = substr($Criteria[$x], 0, 1); $where[$ctable] = substr($Criteria[$x], 0, 1);
} }
} }
@@ -767,7 +768,8 @@ if (isset($Field) && count($Field) > 0) {
// if we don't find anything we try the other way round // if we don't find anything we try the other way round
/* /*
removed this again - i think those that are only connected as a foreign key should not have a chance to be master removed this again - i think those that are only connected as a foreign
key should not have a chance to be master
if (mysql_num_rows($rel_id) == 0) { if (mysql_num_rows($rel_id) == 0) {
$rel_query = 'SELECT foreign_table AS wer, COUNT(master_table) AS hits FROM ' . PMA_backquote($cfg['Server']['relation']) $rel_query = 'SELECT foreign_table AS wer, COUNT(master_table) AS hits FROM ' . PMA_backquote($cfg['Server']['relation'])
. ' WHERE master_table IN ' . $incrit . ' AND foreign_table IN ' . $incrit . ' WHERE master_table IN ' . $incrit . ' AND foreign_table IN ' . $incrit
@@ -795,7 +797,12 @@ if (isset($Field) && count($Field) > 0) {
} // end while } // end while
reset($wheretabs); reset($wheretabs);
} // end while } // end while
if ($master!='') {
if ($ex == 1 || $hit != 2) {
// if $ex is not 1 then obviously none of the tables that are used
// in the whereclause could be found - that means that using left
// joins doesn't make much sense anyway
if ($master != '') { if ($master != '') {
$qry_from = PMA_backquote($master); $qry_from = PMA_backquote($master);
} }
@@ -853,6 +860,7 @@ if (isset($Field) && count($Field) > 0) {
. ' WHERE master_table IN ' . $incrit_s . ' AND foreign_table IN ' . $incrit_d . ' WHERE master_table IN ' . $incrit_s . ' AND foreign_table IN ' . $incrit_d
. ' ORDER BY master_table, foreign_table'; . ' ORDER BY master_table, foreign_table';
$rel_id = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); $rel_id = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url);
while ($row = mysql_fetch_array($rel_id)) { while ($row = mysql_fetch_array($rel_id)) {
$found_table = $row['master_table']; $found_table = $row['master_table'];
if ($rel[$found_table]['mcon'] == 0) { if ($rel[$found_table]['mcon'] == 0) {