display field maintenance
This commit is contained in:
@@ -52,7 +52,22 @@ if (!empty($cfg['Server']['relation'])
|
|||||||
} // end if... else....
|
} // end if... else....
|
||||||
} // end while
|
} // end while
|
||||||
} // end if
|
} // end if
|
||||||
|
if (!empty($cfg['Server']['table_info'])
|
||||||
|
&& isset($submit_show) && $submit_show == 'true') {
|
||||||
|
$test_query = 'SELECT display_field from ' . PMA_backquote($cfg['Server']['table_info'])
|
||||||
|
. ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\' ';
|
||||||
|
$test_rs = mysql_query($test_query) or PMA_mysqlDie('', $test_query, '', $err_url_0);
|
||||||
|
if(mysql_num_rows($test_rs) > 0){
|
||||||
|
$upd_query = 'UPDATE ' . PMA_backquote($cfg['Server']['table_info']) . ' SET'
|
||||||
|
. ' display_field = \'' . PMA_sqlAddslashes($display_field) .'\' '
|
||||||
|
. ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\' ';
|
||||||
|
$upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0);
|
||||||
|
}else{
|
||||||
|
$ins_query = 'insert into ' . PMA_backquote($cfg['Server']['table_info']) . ' (table_name,display_field)'
|
||||||
|
. ' values(\'' . PMA_sqlAddslashes($table) . '\',\'' . PMA_sqlAddslashes($display_field) .'\') ';
|
||||||
|
$ins_rs = mysql_query($ins_query) or PMA_mysqlDie('', $ins_query, '', $err_url_0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog
|
* Dialog
|
||||||
@@ -157,6 +172,36 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
} // end if
|
||||||
|
if (!empty($cfg['Server']['table_info'])){
|
||||||
|
?>
|
||||||
|
<form action="tbl_relation.php3" method="post">
|
||||||
|
<input type="hidden" name="submit_show" value="true" />
|
||||||
|
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||||
|
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||||
|
<p><?php echo $strChangeDisplay; ?></P>
|
||||||
|
<select name="display_field" onchange="this.form.submit(); ">
|
||||||
|
<?php
|
||||||
|
$disp_query = 'SELECT display_field from ' . PMA_backquote($cfg['Server']['table_info'])
|
||||||
|
. ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\' ';
|
||||||
|
$disp_rs = mysql_query($disp_query) or PMA_mysqlDie('', $disp_query, '', $err_url_0);
|
||||||
|
$row = mysql_fetch_array($disp_rs);
|
||||||
|
if(isset($row['display_field'])){
|
||||||
|
$disp = $row['display_field'];
|
||||||
|
}
|
||||||
|
$col_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table);
|
||||||
|
$col_rs = mysql_query($col_query) or PMA_mysqlDie('', $col_query, '', $err_url_0);
|
||||||
|
while ($row = @mysql_fetch_array($col_rs)){
|
||||||
|
echo '<option value="' . htmlspecialchars($row['Field']) . '"';
|
||||||
|
if (isset($disp) && $row['Field'] == $disp) {
|
||||||
|
echo ' selected="selected"';
|
||||||
|
}
|
||||||
|
echo '>' . htmlspecialchars($row['Field']) . '</option>'. "\n";
|
||||||
|
}?>
|
||||||
|
</select>
|
||||||
|
<input type="submit" value="<?php echo $strGo; ?>" />
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} // end if
|
} // end if
|
||||||
|
Reference in New Issue
Block a user