⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tbl_select.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 2 页
字号:
            foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {                echo "\n" . '                        '                   . '<option value="' .  htmlspecialchars($fc) . '">'                   . htmlspecialchars($fc) . '</option>';            }        } // end if... else...        if ($fields_null[$i]) {            foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {                echo "\n" . '                        '                   . '<option value="' .  htmlspecialchars($fc) . '">'                   . htmlspecialchars($fc) . '</option>';            }        }        ?>                </select>            </td>            <td>        <?php        // <markus@noga.de>        $field = $fields_list[$i];        // do not use require_once here        require('./libraries/get_foreign.lib.php');        // we got a bug report: in some cases, even if $disp is true,        // there are no rows, so we add a fetch_array        if ($foreigners && isset($foreigners[$field]) && isset($disp_row) && is_array($disp_row)) {            // f o r e i g n    k e y s            echo '            <select name="fields[' . $i . ']">' . "\n";            // go back to first row            // here, the 4th parameter is empty because there is no current            // value of data for the dropdown (the search page initial values            // are displayed empty)            echo PMA_foreignDropdown($disp_row, $foreign_field, $foreign_display,                '', $GLOBALS['cfg']['ForeignKeyMaxLimit']);            echo '            </select>' . "\n";        } elseif (isset($foreign_link) && $foreign_link == true) {            ?>            <input type="text" name="fields[<?php echo $i; ?>]"                id="field_<?php echo md5($field); ?>[<?php echo $i; ?>]"                class="textfield" />            <script type="text/javascript" language="javascript">                document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&amp;field=<?php echo urlencode($field); ?>&amp;fieldkey=<?php echo $i; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');            </script>            <?php        } elseif (strncasecmp($fields_type[$i], 'enum', 4) == 0) {            // e n u m s            $enum_value=explode(', ', str_replace("'", '', substr($fields_type[$i], 5, -1)));            $cnt_enum_value = count($enum_value);            echo '            <select name="fields[' . $i . '][]"'                .' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n";            for ($j = 0; $j < $cnt_enum_value; $j++) {                echo '                <option value="' . $enum_value[$j] . '">'                    . $enum_value[$j] . '</option>';            } // end for            echo '            </select>' . "\n";        } else {            // o t h e r   c a s e s            echo '            <input type="text" name="fields[' . $i . ']"'                .' size="40" class="textfield" id="field_' . $i . '" />' .  "\n";        };        $type = $fields_type[$i];        if ($type == 'date' || $type == 'datetime' || substr($type, 0, 9) == 'timestamp') {        ?>                    <script type="text/javascript" language="javascript">                    //<![CDATA[                    document.write('<a title="<?php echo $strCalendar;?>" href="javascript:openCalendar(\'<?php echo PMA_generate_common_url();?>\', \'insertForm\', \'field_<?php echo ($i); ?>\', \'<?php echo (PMA_MYSQL_INT_VERSION >= 40100 && substr($type, 0, 9) == 'timestamp') ? 'datetime' : substr($type, 0, 9); ?>\')"><img class="calendar" src="<?php echo $pmaThemeImage; ?>b_calendar.png" alt="<?php echo $strCalendar; ?>"/></a>');                    //]]>                    </script>        <?php        }         ?>            <input type="hidden" name="names[<?php echo $i; ?>]"                value="<?php echo htmlspecialchars($fields_list[$i]); ?>" />            <input type="hidden" name="types[<?php echo $i; ?>]"                value="<?php echo $fields_type[$i]; ?>" />            <input type="hidden" name="collations[<?php echo $i; ?>]"                value="<?php echo $fields_collation[$i]; ?>" />        </td>    </tr>        <?php    } // end for    ?>    </tbody>    </table></fieldset><fieldset class="tblFooters">    <input type="hidden" name="max_number_of_fields"        value="<?php echo $fields_cnt; ?>" />    <input type="submit" name="submit" value="<?php echo $strGo; ?>" /></fieldset></form>    <?php    require_once('./libraries/footer.inc.php');}/** * Selection criteria have been submitted -> do the work */else {    // Builds the query    $sql_query = 'SELECT ' . (isset($distinct) ? 'DISTINCT ' : '');    // if all fields were selected to display, we do a SELECT *    // (more efficient and this helps prevent a problem in IE    // if one of the rows is edited and we come back to the Select results)    if (count($param) == $max_number_of_fields) {        $sql_query .= '* ';    } else {        $param = PMA_backquote( $param );        $sql_query .= implode( ', ', $param );        unset( $param );    } // end if    $sql_query .= ' FROM ' . PMA_backquote($table);    // The where clause    if (trim($where) != '') {        $sql_query .= ' WHERE ' . $where;    } else {        $w = $charsets = array();        $cnt_func = count($func);        reset($func);        while (list($i, $func_type) = each($func)) {            if (PMA_MYSQL_INT_VERSION >= 40100) {                list($charsets[$i]) = explode('_', $collations[$i]);            }            if (@$GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) {                $fields[$i] = '';                $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type;            } elseif (strncasecmp($types[$i], 'enum', 4) == 0) {                if (!empty($fields[$i])) {                    if (!is_array($fields[$i])) {                        $fields[$i] = explode(',', $fields[$i]);                    }                    $enum_selected_count = count($fields[$i]);                    if ($func_type == '=' && $enum_selected_count > 1) {                        $func_type    = $func[$i] = 'IN';                        $parens_open  = '(';                        $parens_close = ')';                    } elseif ($func_type == '!=' && $enum_selected_count > 1) {                        $func_type    = $func[$i] = 'NOT IN';                        $parens_open  = '(';                        $parens_close = ')';                    } else {                        $parens_open  = '';                        $parens_close = '';                    }                    $enum_where = '\'' . PMA_sqlAddslashes($fields[$i][0]) . '\'';                    if (PMA_MYSQL_INT_VERSION >= 40100 && $charsets[$i] != $charset_connection) {                        $enum_where = 'CONVERT(_utf8 ' . $enum_where . ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i];                    }                    for ($e = 1; $e < $enum_selected_count; $e++) {                        $enum_where .= ', ';                        $tmp_literal = '\'' . PMA_sqlAddslashes($fields[$i][$e]) . '\'';                        if (PMA_MYSQL_INT_VERSION >= 40100 && $charsets[$i] != $charset_connection) {                            $tmp_literal = 'CONVERT(_utf8 ' . $tmp_literal . ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i];                        }                        $enum_where .= $tmp_literal;                        unset($tmp_literal);                    }                    $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;                }            } elseif ($fields[$i] != '') {                // For these types we quote the value. Even if it's another type (like INT),                // for a LIKE we always quote the value. MySQL converts strings to numbers                // and numbers to strings as necessary during the comparison                if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types[$i]) || strpos(' ' . $func_type, 'LIKE')) {                    $quot = '\'';                } else {                    $quot = '';                }                // Make query independant from the selected connection charset.                // But if the field's type is VARBINARY, it has no charset                // and $charsets[$i] is empty, so we cannot generate a CONVERT                if (PMA_MYSQL_INT_VERSION >= 40101 && !empty($charsets[$i]) && $charsets[$i] != $charset_connection && preg_match('@char|binary|blob|text|set@i', $types[$i])) {                    $prefix = 'CONVERT(_utf8 ';                    $suffix = ' USING ' . $charsets[$i] . ') COLLATE ' . $collations[$i];                } else {                    $prefix = $suffix = '';                }                // LIKE %...%                if ($func_type == 'LIKE %...%') {                    $func_type = 'LIKE';                    $fields[$i] = '%' . $fields[$i] . '%';                }                $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type . ' ' . $prefix . $quot . PMA_sqlAddslashes($fields[$i]) . $quot . $suffix;            } // end if        } // end for        if ($w) {            $sql_query .= ' WHERE ' . implode(' AND ', $w);        }    } // end if    if ($orderField != '--nil--') {        $sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order;    } // end if    include('./sql.php');}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -