📄 tbl_select.php
字号:
<?php/* $Id: tbl_select.php,v 2.37 2006/01/17 17:02:29 cybot_tm Exp $ */// vim: expandtab sw=4 ts=4 sts=4:/** * Gets some core libraries */require_once('./libraries/common.lib.php');require_once('./libraries/relation.lib.php'); // foreign keysrequire_once('./libraries/mysql_charsets.lib.php');if ( $GLOBALS['cfg']['PropertiesIconic'] == true ) { $titles['Browse'] = '<img class="icon" width="16" height="16" src="' . $pmaThemeImage .'b_browse.png" alt="' . $strBrowseForeignValues . '" title="' .$strBrowseForeignValues . '" />'; if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') { $titles['Browse'] .= $strBrowseForeignValues; }} else { $titles['Browse'] = $strBrowseForeignValues;}/** * Not selection yet required -> displays the selection form */if (!isset($param) || $param[0] == '') { // Gets some core libraries require_once('./libraries/tbl_properties_common.php'); //$err_url = 'tbl_select.php' . $err_url; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; /** * Gets tables informations */ require_once('./libraries/tbl_properties_table_info.inc.php'); /** * Displays top menu links */ require_once('./libraries/tbl_properties_links.inc.php'); if (!isset($goto)) { $goto = $GLOBALS['cfg']['DefaultTabTable']; } // Defines the url to return to in case of error in the next sql statement $err_url = $goto . '?' . PMA_generate_common_url($db, $table); // Gets the list and number of fields $result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE); $fields_cnt = PMA_DBI_num_rows($result); // rabue: we'd better ensure, that all arrays are empty. $fields_list = $fields_null = $fields_type = $fields_collation = array(); while ($row = PMA_DBI_fetch_assoc($result)) { $fields_list[] = $row['Field']; $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 if (strncasecmp($type, 'set', 3) == 0 || strncasecmp($type, 'enum', 4) == 0) { $type = str_replace(',', ', ', $type); } else { // strip the "BINARY" attribute, except if we find "BINARY(" because // this would be a BINARY or VARBINARY field type if (!preg_match('@BINARY[\(]@i', $type)) { $type = preg_replace('@BINARY@i', '', $type); } $type = preg_replace('@ZEROFILL@i', '', $type); $type = preg_replace('@UNSIGNED@i', '', $type); $type = strtolower($type); } if (empty($type)) { $type = ' '; } $fields_null[] = $row['Null']; $fields_type[] = $type; $fields_collation[] = PMA_MYSQL_INT_VERSION >= 40100 && !empty($row['Collation']) && $row['Collation'] != 'NULL' ? $row['Collation'] : ''; } // end while PMA_DBI_free_result($result); unset($result, $type); // <markus@noga.de> // retrieve keys into foreign fields, if any $cfgRelation = PMA_getRelationsParam(); // check also foreigners even if relwork is FALSE (to get // foreign keys from innodb) //$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE); $foreigners = PMA_getForeigners($db, $table); ?><script type="text/javascript" language="javascript">// <![CDATA[function PMA_tbl_select_operator(f, index, multiple) { switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) {<?phpreset( $GLOBALS['cfg']['UnaryOperators'] );while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { echo ' case "' . $operator . "\":\r\n";}?> bDisabled = true; break; default: bDisabled = false; } f.elements["fields[" + index + "]" + ((multiple) ? "[]": "")].disabled = bDisabled;}// ]]></script><form method="post" action="tbl_select.php" name="insertForm"><?php echo PMA_generate_common_hidden_inputs($db, $table); ?><input type="hidden" name="goto" value="<?php echo $goto; ?>" /><input type="hidden" name="back" value="tbl_select.php" /><fieldset id="fieldset_table_search"><fieldset id="fieldset_select_fields"> <legend><?php echo $strSelectFields; ?></legend> <select name="param[]" size="<?php echo min($fields_cnt, 10); ?>" multiple="multiple"> <?php // Displays the list of the fields foreach ( $fields_list as $each_field ) { echo ' ' .'<option value="' . htmlspecialchars( $each_field ) . '"' .' selected="selected">' . htmlspecialchars( $each_field ) .'</option>' . "\n"; } ?> </select> <input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct" /> <label for="oDistinct">DISTINCT</label></fieldset><fieldset id="fieldset_limit_rows"> <legend><?php echo $strLimitNumRows; ?></legend> <input type="text" size="4" name="session_max_rows" value="<?php echo $GLOBALS['cfg']['MaxRows']; ?>" class="textfield" /></fieldset><fieldset id="fieldset_display_order"> <legend><?php echo $strDisplayOrder; ?></legend> <select name="orderField" style="vertical-align: middle"> <option value="--nil--"></option> <?php foreach ( $fields_list as $each_field ) { echo ' ' .'<option value="' . htmlspecialchars( $each_field ) . '">' .htmlspecialchars( $each_field ) . '</option>' . "\n"; } // end for ?> </select> <div class="formelement"> <input type="radio" name="order" value="ASC" checked="checked" id="sortASC" /> <label for="sortASC"><?php echo $strAscending; ?></label> </div> <div class="formelement"> <input type="radio" name="order" value="DESC" id="sortDESC" /> <label for="sortDESC"><?php echo $strDescending; ?></label> </div></fieldset><br class="clearfloat" /><?php echo $strAddSearchConditions; ?><?php echo PMA_showMySQLDocu('SQL-Syntax', 'Functions'); ?><input type="text" name="where" class="textfield" size="64" /></fieldset><fieldset class="tblFooters"> <input type="submit" name="submit" value="<?php echo $strGo; ?>" /></fieldset><fieldset id="fieldset_table_qbe"> <legend><?php echo '<em>' . $strOr . '</em> ' . $strDoAQuery; ?></legend> <table class="data"> <thead> <tr><th><?php echo $strField; ?></th> <th><?php echo $strType; ?></th> <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '<th>' . $strCollation . '</th>' . "\n" : ''; ?> <th><?php echo $strOperator; ?></th> <th><?php echo $strValue; ?></th> </tr> </thead> <tbody> <?php $odd_row = true; for ($i = 0; $i < $fields_cnt; $i++) { ?> <tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>"> <th><?php echo htmlspecialchars($fields_list[$i]); ?></th> <td><?php echo $fields_type[$i]; ?></td> <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '<td>' . $fields_collation[$i] . '</td>' . "\n" : ''; ?> <td><select name="func[]"> <?php if (strncasecmp($fields_type[$i], 'enum', 4) == 0) { foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) { echo "\n" . ' ' . '<option value="' . htmlspecialchars($fc) . '">' . htmlspecialchars($fc) . '</option>'; } } elseif (preg_match('@char|blob|text|set@i', $fields_type[$i])) { foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -