当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_mysql_query函数代码示例

本文整理汇总了PHP中PMA_mysql_query函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_mysql_query函数的具体用法?PHP PMA_mysql_query怎么用?PHP PMA_mysql_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_mysql_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_myHandler

/**
 * Insert data from one table to another one
 *
 * @param   string  the original insert statement
 *
 * @global  string  the database name
 * @global  string  the original table name
 * @global  string  the target database and table names
 * @global  string  the sql query used to copy the data
 */
function PMA_myHandler($sql_insert = '')
{
    global $db, $table, $target;
    global $sql_insert_data;
    $sql_insert = preg_replace('~INSERT INTO (`?)' . $table . '(`?)~i', 'INSERT INTO ' . $target, $sql_insert);
    $result = PMA_mysql_query($sql_insert) or PMA_mysqlDie('', $sql_insert, '', $GLOBALS['err_url']);
    $sql_insert_data .= $sql_insert . ';' . "\n";
}
开发者ID:quartemer,项目名称:xoopserver,代码行数:18,代码来源:tbl_move_copy.php

示例2: PMA_getSearchSqls

 /**
  * Builds the SQL search query
  *
  * @param   string   the table name
  * @param   string   the string to search
  * @param   integer  type of search (1 -> 1 word at least, 2 -> all words,
  *                                   3 -> exact string, 4 -> regexp)
  *
  * @return  array    3 SQL querys (for count, display and delete results)
  *
  * @global  string   the url to retun to in case of errors
  */
 function PMA_getSearchSqls($table, $search_str, $search_option)
 {
     global $err_url;
     // Statement types
     $sqlstr_select = 'SELECT';
     $sqlstr_delete = 'DELETE';
     // Fields to select
     $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']);
     $res = @PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, $err_url);
     $res_cnt = $res ? mysql_num_rows($res) : 0;
     for ($i = 0; $i < $res_cnt; $i++) {
         $tblfields[] = PMA_backquote(PMA_mysql_result($res, $i, 'field'));
     }
     // end if
     $sqlstr_fieldstoselect = ' ' . implode(', ', $tblfields);
     $tblfields_cnt = count($tblfields);
     if ($res) {
         mysql_free_result($res);
     }
     // Table to use
     $sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
     // Beginning of WHERE clause
     $sqlstr_where = ' WHERE';
     $search_words = $search_option > 2 ? array($search_str) : explode(' ', $search_str);
     $search_wds_cnt = count($search_words);
     $like_or_regex = $search_option == 4 ? 'REGEXP' : 'LIKE';
     $automatic_wildcard = $search_option < 3 ? '%' : '';
     for ($i = 0; $i < $search_wds_cnt; $i++) {
         // Elimines empty values
         if (!empty($search_words[$i])) {
             for ($j = 0; $j < $tblfields_cnt; $j++) {
                 $thefieldlikevalue[] = $tblfields[$j] . ' ' . $like_or_regex . ' \'' . $automatic_wildcard . $search_words[$i] . $automatic_wildcard . '\'';
             }
             // end for
             $fieldslikevalues[] = $search_wds_cnt > 1 ? '(' . implode(' OR ', $thefieldlikevalue) . ')' : implode(' OR ', $thefieldlikevalue);
             unset($thefieldlikevalue);
         }
         // end if
     }
     // end for
     $implode_str = $search_option == 1 ? ' OR ' : ' AND ';
     $sqlstr_where .= ' ' . implode($implode_str, $fieldslikevalues);
     unset($fieldslikevalues);
     // Builds complete queries
     $sql['select_fields'] = $sqlstr_select . $sqlstr_fieldstoselect . $sqlstr_from . $sqlstr_where;
     $sql['select_count'] = $sqlstr_select . ' COUNT(*) AS count' . $sqlstr_from . $sqlstr_where;
     $sql['delete'] = $sqlstr_delete . $sqlstr_from . $sqlstr_where;
     return $sql;
 }
开发者ID:quartemer,项目名称:xoopserver,代码行数:61,代码来源:db_search.php

示例3: PMA_backquote

                    } else {
                        $a_query = 'DELETE FROM ';
                    }
                    $a_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])));
                    break;
                case 'drop_fld':
                    PMA_relationsCleanupColumn($db, $table, $selected[$i]);
                    $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) : ',') . ' DROP ' . PMA_backquote(urldecode($selected[$i])) . ($i == $selected_cnt - 1 ? ';' : '');
                    break;
            }
            // end switch
            // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
            // statements will be run at once below
            if ($query_type != 'drop_tbl' && $query_type != 'drop_fld' && $query_type != 'repair_tbl' && $query_type != 'analyze_tbl' && $query_type != 'optimize_tbl' && $query_type != 'check_tbl') {
                $sql_query .= $a_query . ';' . "\n";
                if ($query_type != 'drop_db') {
                    PMA_mysql_select_db($db);
                }
                $result = @PMA_mysql_query($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
            }
            // end if
        }
        // end for
        if ($query_type == 'drop_tbl' || $query_type == 'drop_fld') {
            PMA_mysql_select_db($db);
            $result = @PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
        } elseif ($query_type == 'repair_tbl' || $query_type == 'analyze_tbl' || $query_type == 'check_tbl' || $query_type == 'optimize_tbl') {
            require './sql.php';
        }
    }
}
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:mult_submits.inc.php

示例4: PMA_mysql_select_db

/**
 * Ensures db and table are valid, else moves to the "parent" script
 */
require_once './libraries/db_table_exists.lib.php';
/**
 * Get the list of the fields of the current table
 */
PMA_mysql_select_db($db);
$table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
if (isset($primary_key)) {
    $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
    $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', '');
    $row = PMA_mysql_fetch_array($result);
} else {
    $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
    $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', '');
    $row = PMA_mysql_fetch_array($result);
}
// No row returned
if (!$row) {
    exit;
}
// end if (no record returned)
$default_ct = 'application/octet-stream';
if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
    $mime_map = PMA_getMime($db, $table);
    $mime_options = PMA_transformation_getOptions(isset($mime_map[urldecode($transform_key)]['transformation_options']) ? $mime_map[urldecode($transform_key)]['transformation_options'] : '');
    foreach ($mime_options as $key => $option) {
        if (substr($option, 0, 10) == '; charset=') {
            $mime_options['charset'] = $option;
        }
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:transformation_wrapper.php

示例5: PMA_backquote

                        $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
                        $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
                        $sts_tmp = PMA_mysql_fetch_array($sts_result);
                        $tables[] = $sts_tmp;
                    } else {
                        // table in use
                        $tables[] = array('Name' => $tmp[0]);
                    }
                }
                mysql_free_result($db_info_result);
                $sot_ready = TRUE;
            }
        }
    }
}
if (!isset($sot_ready)) {
    $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
    $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
    if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
        while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
            $tables[] = $sts_tmp;
        }
        mysql_free_result($db_info_result);
    }
}
$num_tables = isset($tables) ? count($tables) : 0;
/**
 * Displays top menu links
 */
echo '<!-- Top menu links -->' . "\n";
require './db_details_links.php';
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:db_details_db_info.php

示例6: PMA_mysqlDie

/**
 * Sends the queries and buffers the results
 */
if (PMA_MYSQL_INT_VERSION >= 40003) {
    $res = @PMA_mysql_query('SHOW SESSION VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW SESSION VARIABLES;');
    while ($row = PMA_mysql_fetch_row($res)) {
        $serverVars[$row[0]] = $row[1];
    }
    @mysql_free_result($res);
    $res = @PMA_mysql_query('SHOW GLOBAL VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW GLOBAL VARIABLES;');
    while ($row = PMA_mysql_fetch_row($res)) {
        $serverVarsGlobal[$row[0]] = $row[1];
    }
    @mysql_free_result($res);
} else {
    $res = @PMA_mysql_query('SHOW VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW VARIABLES;');
    while ($row = PMA_mysql_fetch_row($res)) {
        $serverVars[$row[0]] = $row[1];
    }
    @mysql_free_result($res);
}
unset($res);
unset($row);
/**
 * Displays the page
 */
?>
<table border="0">
    <tr>
        <th>&nbsp;<?php 
echo $strVar;
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:server_variables.php

示例7: PMA_RT_Table

 /**
  * The "PMA_RT_Table" constructor
  *
  * @param   string    The table name
  * @param   integer   The font size
  * @param   integer   The max. with among tables
  *
  * @global  object    The current PDF document
  * @global  integer   The current page number (from the
  *                    $cfg['Servers'][$i]['table_coords'] table)
  * @global  array     The relations settings
  * @global  string    The current db name
  *
  * @access  private
  *
  * @see     PMA_PDF, PMA_RT_Table::PMA_RT_Table_setWidth,
  *          PMA_RT_Table::PMA_RT_Table_setHeight
  */
 function PMA_RT_Table($table_name, $ff, &$same_wide_width)
 {
     global $pdf, $pdf_page_number, $cfgRelation, $db;
     $this->table_name = $table_name;
     $sql = 'DESCRIBE ' . PMA_backquote($table_name);
     $result = PMA_mysql_query($sql);
     if (!$result || !mysql_num_rows($result)) {
         $pdf->PMA_PDF_die(sprintf($GLOBALS['strPdfInvalidTblName'], $table_name));
     }
     // load fields
     while ($row = PMA_mysql_fetch_array($result)) {
         $this->fields[] = $row[0];
     }
     //height and width
     $this->PMA_RT_Table_setWidth($ff);
     $this->PMA_RT_Table_setHeight();
     if ($same_wide_width < $this->width) {
         $same_wide_width = $this->width;
     }
     //x and y
     $sql = 'SELECT x, y FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND   table_name = \'' . PMA_sqlAddslashes($table_name) . '\'' . ' AND   pdf_page_number = ' . $pdf_page_number;
     $result = PMA_query_as_cu($sql);
     if (!$result || !mysql_num_rows($result)) {
         $pdf->PMA_PDF_die(sprintf($GLOBALS['strConfigureTableCoord'], $table_name));
     }
     list($this->x, $this->y) = PMA_mysql_fetch_array($result);
     $this->x = (double) $this->x;
     $this->y = (double) $this->y;
     // displayfield
     $this->displayfield = PMA_getDisplayField($db, $table_name);
     // index
     $sql = 'SHOW index FROM ' . PMA_backquote($table_name);
     $result = PMA_mysql_query($sql);
     if ($result && mysql_num_rows($result) > 0) {
         while ($row = PMA_mysql_fetch_array($result)) {
             if ($row['Key_name'] == 'PRIMARY') {
                 $this->primary[] = $row['Column_name'];
             }
         }
     }
     // end if
 }
开发者ID:quartemer,项目名称:xoopserver,代码行数:60,代码来源:pdf_schema.php

示例8: phpinfo

<?php

/* $Id: phpinfo.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Gets core libraries and defines some variables
 */
require_once './libraries/grab_globals.lib.php';
require_once './libraries/common.lib.php';
/**
 * Displays PHP information
 */
$is_superuser = @PMA_mysql_query('USE mysql', $userlink);
if ($is_superuser || $cfg['ShowPhpInfo']) {
    phpinfo();
}
开发者ID:quartemer,项目名称:xoopserver,代码行数:16,代码来源:phpinfo.php

示例9: count

     }
 }
 // end if
 // Builds the fulltext statements and updates the table
 $fulltext = '';
 if (isset($field_fulltext)) {
     $fulltext_cnt = count($field_fulltext);
     for ($i = 0; $i < $fulltext_cnt; $i++) {
         $j = $field_fulltext[$i];
         $fulltext .= PMA_backquote($field_name[$j]) . ', ';
     }
     // end for
     $fulltext = preg_replace('@, $@', '', $fulltext);
     if (!empty($fulltext)) {
         $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
         $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
         $sql_query_cpy .= "\n" . $sql_query . ';';
     }
 }
 // end if
 // garvin: If comments were sent, enable relation stuff
 require_once './libraries/relation.lib.php';
 require_once './libraries/transformations.lib.php';
 $cfgRelation = PMA_getRelationsParam();
 // garvin: Update comment table, if a comment was set.
 if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
     foreach ($field_comments as $fieldindex => $fieldcomment) {
         PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment);
     }
 }
 // garvin: Update comment table for mime types [MIME]
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:tbl_addfield.php

示例10: array

echo '<h2>' . "\n" . '    ' . (empty($dbstats) ? $strDatabases : $strDatabasesStats) . "\n" . '</h2>' . "\n";
/**
 * Checks if the user is allowed to do what he tries to...
 */
if (!empty($dbstats) && !$is_superuser) {
    echo $strNoPrivileges . "\n";
    require_once './footer.inc.php';
}
/**
 * Prepares the statistics
 */
$statistics = array();
foreach ($dblist as $current_db) {
    $tmp_array = array('db_name' => $current_db, 'tbl_cnt' => 0, 'data_sz' => 0, 'idx_sz' => 0, 'tot_sz' => 0);
    if (!empty($dbstats)) {
        $res = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($current_db) . ';', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW TABLE STATUS FROM ' . PMA_backquote($current_db) . ';');
        while ($row = PMA_mysql_fetch_array($res, MYSQL_ASSOC)) {
            $tmp_array['tbl_cnt']++;
            $tmp_array['data_sz'] += $row['Data_length'];
            $tmp_array['idx_sz'] += $row['Index_length'];
        }
    }
    $tmp_array['tot_sz'] = $tmp_array['data_sz'] + $tmp_array['idx_sz'];
    $statistics[] = $tmp_array;
}
// avoids 'undefined index' errors
if (empty($sort_by)) {
    $sort_by = 'db_name';
}
if (empty($sort_order)) {
    if ($sort_by == 'db_name') {
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:server_databases.php

示例11: PMA_generate_common_url

} else {
    if ($num_dbs == 1) {
        $db = $dblist[0];
        $tables = @PMA_mysql_list_tables($db);
        $num_tables = $tables ? @mysql_numrows($tables) : 0;
        $common_url_query = PMA_generate_common_url($db);
        if ($num_tables) {
            $num_tables_disp = $num_tables;
        } else {
            $num_tables_disp = '-';
        }
        // Get additional infomation about tables for tooltip
        if ($cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303 && $num_tables) {
            $tooltip = array();
            $tooltip_name = array();
            $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
            while ($tmp = PMA_mysql_fetch_array($result)) {
                $tooltip_name[$tmp['Name']] = !empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '';
                $tmp['Comment'] = $cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : $tmp['Comment'];
                $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '') . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')';
            }
            // end while
        }
        // end if
        // garvin: Get comments from PMA comments table
        $db_tooltip = '';
        if ($cfg['ShowTooltip'] && $cfgRelation['commwork']) {
            $tmp_db_tooltip = PMA_getComments($db);
            if (is_array($tmp_db_tooltip)) {
                $db_tooltip = implode(' ', $tmp_db_tooltip);
            }
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:left.php

示例12: PMA_mysql_query

<?php

/* $Id: defines_mysql.lib.php,v 2.1 2003/11/26 22:52:23 rabus Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * DEFINES MYSQL RELATED VARIABLES & CONSTANTS
 * Overview:
 *    PMA_MYSQL_INT_VERSION    (int)    - eg: 32339 instead of 3.23.39
 */
if (!defined('PMA_MYSQL_INT_VERSION') && isset($userlink)) {
    if (!empty($server)) {
        $result = PMA_mysql_query('SELECT VERSION() AS version', $userlink);
        if ($result != FALSE && @mysql_num_rows($result) > 0) {
            $row = PMA_mysql_fetch_array($result);
            $match = explode('.', $row['version']);
            mysql_free_result($result);
        }
    }
    // end server id is defined case
    if (!isset($match) || !isset($match[0])) {
        $match[0] = 3;
    }
    if (!isset($match[1])) {
        $match[1] = 23;
    }
    if (!isset($match[2])) {
        $match[2] = 32;
    }
    if (!isset($row)) {
        $row['version'] = '3.23.32';
    }
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:defines_mysql.lib.php

示例13: preg_replace

        $fieldlist = preg_replace('@, $@', '', $fieldlist);
        $valuelist = preg_replace('@, $@', '', $valuelist);
        $query[] = 'INSERT INTO ' . PMA_backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')';
        $message = $strInsertedRows . '&nbsp;';
    }
}
// end row insertion
/**
 * Executes the sql query and get the result, then move back to the calling
 * page
 */
$sql_query = implode(';', $query) . ';';
$total_affected_rows = 0;
$last_message = '';
foreach ($query as $query_index => $single_query) {
    $result = PMA_mysql_query($single_query);
    if (!$result) {
        if ($cfg['IgnoreMultiSubmitErrors']) {
            $message .= PMA_mysql_error();
        } else {
            $error = PMA_mysql_error();
            require_once './header.inc.php';
            PMA_mysqlDie($error, '', '', $err_url);
        }
    } else {
        if (@mysql_affected_rows()) {
            $total_affected_rows += @mysql_affected_rows();
        }
        $insert_id = mysql_insert_id();
        if ($insert_id != 0) {
            $last_message .= '<br />' . $strInsertedRowId . '&nbsp;' . $insert_id;
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:tbl_replace.php

示例14: PMA_showMessage

    /**
     * Displays a message at the top of the "main" (right) frame
     *
     * @param   string  the message to display
     *
     * @global  array   the configuration array
     *
     * @access  public
     */
    function PMA_showMessage($message)
    {
        global $cfg;
        require_once './header.inc.php';
        // Reloads the navigation frame via JavaScript if required
        if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
            echo "\n";
            $reload_url = './left.php?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', '', '&');
            ?>
<script type="text/javascript" language="javascript1.2">
<!--
if (typeof(window.parent) != 'undefined'
    && typeof(window.parent.frames['nav']) != 'undefined') {
    window.parent.frames['nav'].location.replace('<?php 
            echo $reload_url;
            ?>
&hash=' + <?php 
            echo $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ? 'window.parent.frames[\'queryframe\'].document.hashform.hash.value' : "'" . md5($cfg['PmaAbsoluteUri']) . "'";
            ?>
);
}
//-->
</script>
            <?php 
            unset($GLOBALS['reload']);
        } else {
            if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
                $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
                if ($result) {
                    $tbl_status = PMA_mysql_fetch_array($result, MYSQL_ASSOC);
                    $tooltip = empty($tbl_status['Comment']) ? '' : $tbl_status['Comment'] . ' ';
                    $tooltip .= '(' . $tbl_status['Rows'] . ' ' . $GLOBALS['strRows'] . ')';
                    mysql_free_result($result);
                    $md5_tbl = md5($GLOBALS['table']);
                    echo "\n";
                    ?>
<script type="text/javascript" language="javascript1.2">
<!--
if (typeof(document.getElementById) != 'undefined'
    && typeof(window.parent.frames['nav']) != 'undefined'
    && typeof(window.parent.frames['nav'].document) != 'undefined' && typeof(window.parent.frames['nav'].document) != 'unknown'
    && (window.parent.frames['nav'].document.getElementById('<?php 
                    echo 'tbl_' . $md5_tbl;
                    ?>
'))
    && typeof(window.parent.frames['nav'].document.getElementById('<?php 
                    echo 'tbl_' . $md5_tbl;
                    ?>
')) != 'undefined'
    && typeof(window.parent.frames['nav'].document.getElementById('<?php 
                    echo 'tbl_' . $md5_tbl;
                    ?>
').title) == 'string') {
    window.parent.frames['nav'].document.getElementById('<?php 
                    echo 'tbl_' . $md5_tbl;
                    ?>
').title = '<?php 
                    echo PMA_jsFormat($tooltip, FALSE);
                    ?>
';
}
//-->
</script>
                <?php 
                }
                // end if
            }
        }
        // end if... else if
        // Checks if the table needs to be repaired after a TRUNCATE query.
        if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
            if (!isset($tbl_status)) {
                $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
                if ($result) {
                    $tbl_status = PMA_mysql_fetch_array($result, MYSQL_ASSOC);
                    mysql_free_result($result);
                }
            }
            if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {
                @PMA_mysql_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
            }
        }
        unset($tbl_status);
        echo "\n";
        ?>
<div align="<?php 
        echo $GLOBALS['cell_align_left'];
        ?>
">
    <table border="<?php 
        echo $cfg['Border'];
//.........这里部分代码省略.........
开发者ID:quartemer,项目名称:xoopserver,代码行数:101,代码来源:common.lib.php

示例15: PMA_getRelatives

 /**
  * Finds all related tables
  *
  * @param   string   wether to go from master to foreign or vice versa
  *
  * @return  boolean  always TRUE
  *
  * @global  array    the list of tables that we still couldn't connect
  * @global  array    the list of allready connected tables
  * @global  string   the current databse name
  * @global  string   the super user connection id
  * @global  array    the list of relation settings
  *
  * @access  private
  */
 function PMA_getRelatives($from)
 {
     global $tab_left, $tab_know, $fromclause;
     global $dbh, $db, $cfgRelation;
     if ($from == 'master') {
         $to = 'foreign';
     } else {
         $to = 'master';
     }
     $in_know = '(\'' . implode('\', \'', $tab_know) . '\')';
     $in_left = '(\'' . implode('\', \'', $tab_left) . '\')';
     $rel_query = 'SELECT *' . ' FROM ' . PMA_backquote($cfgRelation['relation']) . ' WHERE ' . $from . '_db   = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND ' . $to . '_db   = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND ' . $from . '_table IN ' . $in_know . ' AND ' . $to . '_table IN ' . $in_left;
     if (isset($dbh)) {
         PMA_mysql_select_db($cfgRelation['db'], $dbh);
         $relations = @PMA_mysql_query($rel_query, $dbh) or PMA_mysqlDie(PMA_mysql_error($dbh), $rel_query, '', $err_url_0);
         PMA_mysql_select_db($db, $dbh);
     } else {
         PMA_mysql_select_db($cfgRelation['db']);
         $relations = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url_0);
         PMA_mysql_select_db($db);
     }
     while ($row = PMA_mysql_fetch_array($relations)) {
         $found_table = $row[$to . '_table'];
         if (isset($tab_left[$found_table])) {
             $fromclause .= "\n" . ' LEFT JOIN ' . PMA_backquote($row[$to . '_table']) . ' ON ' . PMA_backquote($row[$from . '_table']) . '.' . PMA_backquote($row[$from . '_field']) . ' = ' . PMA_backquote($row[$to . '_table']) . '.' . PMA_backquote($row[$to . '_field']) . ' ';
             $tab_know[$found_table] = $found_table;
             $tab_left = PMA_arrayShort($tab_left, $found_table);
         }
     }
     // end while
     return TRUE;
 }
开发者ID:quartemer,项目名称:xoopserver,代码行数:47,代码来源:db_details_qbe.php


注:本文中的PMA_mysql_query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。