/** * Main function for the routines functionality * * @return nothing */ function PMA_RTN_main() { global $db; PMA_RTN_setGlobals(); /** * Process all requests */ PMA_RTN_handleEditor(); PMA_RTN_handleExecute(); PMA_RTN_handleExport(); /** * Display a list of available routines */ $columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, "; $columns .= "`DTD_IDENTIFIER`, `ROUTINE_DEFINITION`"; $where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "'"; $items = PMA_DBI_fetch_result("SELECT {$columns} FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE {$where};"); echo PMA_RTE_getList('routine', $items); /** * Display the form for adding a new routine, if the user has the privileges. */ echo PMA_RTN_getFooterLinks(); /** * Display a warning for users with PHP's old "mysql" extension. */ if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') { trigger_error(__('You are using PHP\'s deprecated \'mysql\' extension, ' . 'which is not capable of handling multi queries. ' . '[strong]The execution of some stored routines may fail![/strong] ' . 'Please use the improved \'mysqli\' extension to ' . 'avoid any problems.'), E_USER_WARNING); } }
/** * checks if MySQL server supports partitioning * * @static * @staticvar boolean $have_partitioning * @staticvar boolean $already_checked * @access public * @return boolean */ public static function havePartitioning() { static $have_partitioning = false; static $already_checked = false; if (!$already_checked) { if (PMA_MYSQL_INT_VERSION >= 50100) { if (PMA_MYSQL_INT_VERSION < 50600) { if (PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'have_partitioning';")) { $have_partitioning = true; } } else { // see http://dev.mysql.com/doc/refman/5.6/en/partitioning.html $plugins = PMA_DBI_fetch_result("SHOW PLUGINS"); foreach ($plugins as $value) { if ($value['Name'] == 'partition') { $have_partitioning = true; break; } } } $already_checked = true; } } return $have_partitioning; }
/** * returns array of storage engines * * @static * @staticvar array $storage_engines storage engines * @access public * @uses PMA_DBI_fetch_result() * @return array of storage engines */ public static function getStorageEngines() { static $storage_engines = null; if (null !== $storage_engines) { return $storage_engines; } return PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine'); }
/** * returns array of partition names for a specific db/table * * @access public * @uses PMA_DBI_fetch_result() * @return array of partition names */ static public function getPartitionNames($db, $table) { if (PMA_Partition::havePartitioning()) { return PMA_DBI_fetch_result("select `PARTITION_NAME` from `information_schema`.`PARTITIONS` where `TABLE_SCHEMA` = '" . $db . "' and `TABLE_NAME` = '" . $table . "'"); } else { return array(); } }
/** * Gets the list of bookmarks defined for the current database * * @uses PMA_backquote() * @uses PMA_sqlAddslashes() * @uses PMA_DBI_fetch_result() * @uses PMA_DBI_QUERY_STORE * @uses PMA_Bookmark_getParams() * @global resource the controluser db connection handle * * @param string the current database name * * @return array the bookmarks list (key as index, label as value) * * @access public */ function PMA_Bookmark_getList($db) { global $controllink; $cfgBookmark = PMA_Bookmark_getParams(); if (empty($cfgBookmark)) { return array(); } $query = 'SELECT label, id FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . ' OR user = \'\')' . ' ORDER BY label'; return PMA_DBI_fetch_result($query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE); }
/** * returns array of storage engines * * @static * @staticvar array $storage_engines storage engines * @access public * @return array of storage engines */ public static function getStorageEngines() { static $storage_engines = null; if (null == $storage_engines) { if (PMA_DRIZZLE) { $sql = "SELECT\n p.plugin_name AS Engine,\n (CASE\n WHEN p.plugin_name = @@storage_engine THEN 'DEFAULT'\n WHEN p.is_active THEN 'YES'\n ELSE 'DISABLED' END) AS Support,\n m.module_description AS Comment\n FROM data_dictionary.plugins p\n JOIN data_dictionary.modules m USING (module_name)\n WHERE p.plugin_type = 'StorageEngine'\n AND p.plugin_name NOT IN ('FunctionEngine', 'schema')"; $storage_engines = PMA_DBI_fetch_result($sql, 'Engine'); } else { $storage_engines = PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine'); } } return $storage_engines; }
/** * returns array of storage engines * * @static * @staticvar array $storage_engines storage engines * @access public * @uses PMA_MYSQL_INT_VERSION * @uses PMA_StorageEngine::getStorageEnginesBefore40102() * @uses PMA_DBI_fetch_result() * @return array of storage engines */ function getStorageEngines() { static $storage_engines = null; if (null !== $storage_engines) { return $storage_engines; } $storage_engines = array(); // SHOW STORAGE ENGINES comes with MySQL 4.1.2 if (PMA_MYSQL_INT_VERSION < 40102) { $storage_engines = PMA_StorageEngine::getStorageEnginesBefore40102(); } else { $storage_engines = PMA_DBI_fetch_result('SHOW STORAGE ENGINES', 'Engine'); } return $storage_engines; }
/** * Gets the list of bookmarks defined for the current database * * @uses PMA_backquote() * @uses PMA_sqlAddslashes() * @uses PMA_DBI_fetch_result() * @uses PMA_DBI_QUERY_STORE * @uses PMA_Bookmark_getParams() * @global resource the controluser db connection handle * * @param string the current database name * * @return array the bookmarks list (key as index, label as value) * * @access public */ function PMA_Bookmark_getList($db) { global $controllink; $cfgBookmark = PMA_Bookmark_getParams(); if (empty($cfgBookmark)) { return array(); } $query = 'SELECT label, id FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . ' ORDER BY label'; $per_user = PMA_DBI_fetch_result($query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE); $query = 'SELECT label, id FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND user = \'\'' . ' ORDER BY label'; $global = PMA_DBI_fetch_result($query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE); foreach ($global as $key => $val) { $global[$key] = $val . ' (' . __('shared') . ')'; } $ret = $global + $per_user; asort($ret); return $ret; }
/** * returns html tables with stats over inno db buffer pool * * @uses PMA_DBI_fetch_result() * @uses PMA_formatNumber() * @uses PMA_formatByteDown() * @uses join() * @uses htmlspecialchars() * @uses PMA_formatNumber() * @return string html table with stats */ function getPageBufferpool() { // The following query is only possible because we know // that we are on MySQL 5 here (checked above)! // side note: I love MySQL 5 for this. :-) $sql = ' SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';'; $status = PMA_DBI_fetch_result($sql, 0, 1); $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . __('Buffer Pool Usage') . "\n" . ' </caption>' . "\n" . ' <tfoot>' . "\n" . ' <tr>' . "\n" . ' <th colspan="2">' . "\n" . ' ' . __('Total') . "\n" . ' : ' . PMA_formatNumber($status['Innodb_buffer_pool_pages_total'], 0) . ' ' . __('pages') . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </tfoot>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Free pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Dirty pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Pages containing data') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Pages to be flushed') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Busy pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n" . '</td>' . "\n" . ' </tr>'; // not present at least since MySQL 5.1.40 if (isset($status['Innodb_buffer_pool_pages_latched'])) { $output .= ' <tr class="even">' . ' <th>' . __('Latched pages') . '</th>' . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . '</td>' . ' </tr>'; } $output .= ' </tbody>' . "\n" . '</table>' . "\n\n" . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . __('Buffer Pool Activity') . "\n" . ' </caption>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read requests') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write requests') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses in %') . '</th>' . "\n" . ' <td class="value">' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits in %') . '</th>' . "\n" . ' <td class="value">' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n"; return $output; }
function run() { // HowTo: A simple Advisory system in 3 easy steps. // Step 1: Get some variables to evaluate on $this->variables = array_merge(PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1), PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1)); if (PMA_DRIZZLE) { $this->variables = array_merge($this->variables, PMA_DBI_fetch_result("SELECT concat('Com_', variable_name), variable_value\n FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1)); } // Add total memory to variables as well include_once 'libraries/sysinfo.lib.php'; $sysinfo = PMA_getSysInfo(); $memory = $sysinfo->memory(); $this->variables['system_memory'] = $memory['MemTotal']; // Step 2: Read and parse the list of rules $this->parseResult = $this->parseRulesFile(); // Step 3: Feed the variables to the rules and let them fire. Sets $runResult $this->runRules(); return array('parse' => array('errors' => $this->parseResult['errors']), 'run' => $this->runResult); }
/** * Main function for the events functionality */ function PMA_EVN_main() { global $db; PMA_EVN_setGlobals(); /** * Process all requests */ PMA_EVN_handleEditor(); PMA_EVN_handleExport(); /** * Display a list of available events */ $columns = "`EVENT_NAME`, `EVENT_TYPE`, `STATUS`"; $where = "EVENT_SCHEMA='" . PMA_sqlAddSlashes($db) . "'"; $query = "SELECT {$columns} FROM `INFORMATION_SCHEMA`.`EVENTS` " . "WHERE {$where} ORDER BY `EVENT_NAME` ASC;"; $items = PMA_DBI_fetch_result($query); echo PMA_RTE_getList('event', $items); /** * Display a link for adding a new event, if * the user has the privileges and a link to * toggle the state of the event scheduler. */ echo PMA_EVN_getFooterLinks(); }
* a db, in which case we want to keep displaying the tabs of * the Database panel */ if (empty($viewing_mode)) { $db = $table = ''; } /** * Set parameters for links */ $url_query = PMA_generate_common_url($db); /** * Defines the urls to return to in case of error in a sql statement */ $err_url = 'main.php' . $url_query; /** * Displays the headers */ require_once './libraries/header.inc.php'; /** * @global boolean Checks for superuser privileges */ $is_superuser = PMA_isSuperuser(); // now, select the mysql db if ($is_superuser) { PMA_DBI_select_db('mysql', $userlink); } /** * @global array binary log files */ $binary_logs = PMA_DBI_fetch_result('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DBI_QUERY_STORE);
/** * Returns array of functions available for a class. * * @param string $class The class to get function list. * * @return array * */ public function getFunctionsClass($class) { switch ($class) { case 'CHAR': $ret = array('BIN', 'CHAR', 'CURRENT_USER', 'COMPRESS', 'DATABASE', 'DAYNAME', 'HEX', 'LOAD_FILE', 'LOWER', 'LTRIM', 'MD5', 'MONTHNAME', 'QUOTE', 'REVERSE', 'RTRIM', 'SCHEMA', 'SPACE', 'TRIM', 'UNCOMPRESS', 'UNHEX', 'UPPER', 'USER', 'UUID', 'VERSION'); // check for some functions known to be in modules $functions = array('MYSQL_PASSWORD', 'ROT13'); // add new functions $sql = "SELECT upper(plugin_name) f\n FROM data_dictionary.plugins\n WHERE plugin_name IN ('" . implode("','", $functions) . "')\n AND plugin_type = 'Function'\n AND is_active"; $drizzle_functions = PMA_DBI_fetch_result($sql, 'f', 'f'); if (count($drizzle_functions) > 0) { $ret = array_merge($ret, $drizzle_functions); sort($ret); } return $ret; case 'UUID': return array('UUID'); case 'DATE': return array('CURRENT_DATE', 'CURRENT_TIME', 'DATE', 'FROM_DAYS', 'FROM_UNIXTIME', 'LAST_DAY', 'NOW', 'SYSDATE', 'TIMESTAMP', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'YEAR'); case 'NUMBER': return array('ABS', 'ACOS', 'ASCII', 'ASIN', 'ATAN', 'BIT_COUNT', 'CEILING', 'CHAR_LENGTH', 'CONNECTION_ID', 'COS', 'COT', 'CRC32', 'DAYOFMONTH', 'DAYOFWEEK', 'DAYOFYEAR', 'DEGREES', 'EXP', 'FLOOR', 'HOUR', 'LENGTH', 'LN', 'LOG', 'LOG2', 'LOG10', 'MICROSECOND', 'MINUTE', 'MONTH', 'OCT', 'ORD', 'PI', 'QUARTER', 'RADIANS', 'RAND', 'ROUND', 'SECOND', 'SIGN', 'SIN', 'SQRT', 'TAN', 'TO_DAYS', 'TIME_TO_SEC', 'UNCOMPRESSED_LENGTH', 'UNIX_TIMESTAMP', 'WEEKDAY', 'WEEKOFYEAR', 'YEARWEEK'); } return array(); }
/** * Get all indexed columns * * returns an array with all columns make use of an index, in fact only * first columns in an index * * f.e. index(col1, col2) would only return col1 * @param boolean whether to quote name with backticks `` * @return array */ public function getIndexedColumns($backquoted = true) { $sql = 'SHOW INDEX FROM ' . $this->getFullName(true) . ' WHERE Seq_in_index = 1'; $indexed = PMA_DBI_fetch_result($sql, 'Column_name', 'Column_name'); $return = array(); foreach ($indexed as $column) { $return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column); } return $return; }
* function. This needs further reseach because a procedure * does not necessarily contain a SELECT statement that * produces something to see. But it seems we could at least * get the number of rows affected. We would have to * use the CLIENT_MULTI_RESULTS flag to get the result set * and also the call status. All this does not fit well with * our current sql.php. * Of course the interface would need a way to pass calling parameters. * Also, support DEFINER (like we do in export). * @version $Id$ * @package phpMyAdmin */ if (!defined('PHPMYADMIN')) { exit; } $routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db, true) . '\';'); if ($routines) { PMA_generate_slider_effect('routines', $strRoutines); echo '<fieldset>' . "\n"; echo ' <legend>' . $strRoutines . '</legend>' . "\n"; echo '<table border="0">'; echo sprintf('<tr> <th>%s</th> <th> </th> <th> </th> <th>%s</th> <th>%s</th> </tr>', $strName, $strType, $strRoutineReturnType); $ct = 0; $delimiter = '//'; foreach ($routines as $routine) {
/** * prints querybox fieldset * * @usedby PMA_sqlQueryForm() * @uses $GLOBALS['text_dir'] * @uses $GLOBALS['cfg']['TextareaAutoSelect'] * @uses $GLOBALS['cfg']['TextareaCols'] * @uses $GLOBALS['cfg']['TextareaRows'] * @uses $GLOBALS['strShowThisQuery'] * @uses $GLOBALS['strGo'] * @uses PMA_availableDatabases() * @uses PMA_USR_OS * @uses PMA_USR_BROWSER_AGENT * @uses PMA_USR_BROWSER_VER * @uses PMA_availableDatabases() * @uses htmlspecialchars() * @param string $query query to display in the textarea * @param boolean $is_querywindow if inside querywindow or not */ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false) { // enable auto select text in textarea if ($GLOBALS['cfg']['TextareaAutoSelect']) { $auto_sel = ' onfocus="selectContent( this, sql_box_locked, true )"'; } else { $auto_sel = ''; } // enable locking if inside query window if ($is_querywindow) { $locking = ' onkeypress="document.sqlform.elements[\'LockFromUpdate\'].' . 'checked = true;"'; } else { $locking = ''; } $table = ''; $db = ''; $fields_list = array(); if (!isset($GLOBALS['db']) || !strlen($GLOBALS['db'])) { // prepare for server related $legend = sprintf($GLOBALS['strRunSQLQueryOnServer'], htmlspecialchars($GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'])); } elseif (!isset($GLOBALS['table']) || !strlen($GLOBALS['table'])) { // prepare for db related $db = $GLOBALS['db']; // if you want navigation: $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db) . '"'; if ($is_querywindow) { $strDBLink .= ' target="_self"' . ' onclick="this.target=window.opener.frames[1].name"'; } $strDBLink .= '>' . htmlspecialchars($db) . '</a>'; // else use // $strDBLink = htmlspecialchars($db); $legend = sprintf($GLOBALS['strRunSQLQuery'], $strDBLink); if (empty($query)) { $query = str_replace('%d', PMA_backquote($db), $GLOBALS['cfg']['DefaultQueryDatabase']); } } else { $table = $GLOBALS['table']; $db = $GLOBALS['db']; // Get the list and number of fields // we do a try_query here, because we could be in the query window, // trying to synchonize and the table has not yet been created $fields_list = PMA_DBI_fetch_result('SHOW FULL COLUMNS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($GLOBALS['table'])); $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db) . '"'; if ($is_querywindow) { $strDBLink .= ' target="_self"' . ' onclick="this.target=window.opener.frames[1].name"'; } $strDBLink .= '>' . htmlspecialchars($db) . '</a>'; // else use // $strDBLink = htmlspecialchars($db); $legend = sprintf($GLOBALS['strRunSQLQuery'], $strDBLink); if (empty($query) && count($fields_list)) { $field_names = array(); foreach ($fields_list as $field) { $field_names[] = PMA_backquote($field['Field']); } $query = str_replace('%d', PMA_backquote($db), str_replace('%t', PMA_backquote($table), str_replace('%f', implode(', ', $field_names), $GLOBALS['cfg']['DefaultQueryTable']))); unset($field_names); } } $legend .= ': ' . PMA_showMySQLDocu('SQL-Syntax', 'SELECT'); if (count($fields_list)) { $sqlquerycontainer_id = 'sqlquerycontainer'; } else { $sqlquerycontainer_id = 'sqlquerycontainerfull'; } echo '<a name="querybox"></a>' . "\n" . '<div id="queryboxcontainer">' . "\n" . '<fieldset id="querybox">' . "\n"; echo '<legend>' . $legend . '</legend>' . "\n"; echo '<div id="queryfieldscontainer">' . "\n"; echo '<div id="' . $sqlquerycontainer_id . '">' . "\n" . '<textarea name="sql_query" id="sqlquery"' . ' cols="' . $GLOBALS['cfg']['TextareaCols'] . '"' . ' rows="' . $GLOBALS['cfg']['TextareaRows'] . '"' . ' dir="' . $GLOBALS['text_dir'] . '"' . $auto_sel . $locking . '>' . htmlspecialchars($query) . '</textarea>' . "\n"; echo '</div>' . "\n"; if (count($fields_list)) { echo '<div id="tablefieldscontainer">' . "\n" . '<label>' . $GLOBALS['strFields'] . '</label>' . "\n" . '<select id="tablefields" name="dummy" ' . 'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" ' . 'multiple="multiple" ondblclick="insertValueQuery()">' . "\n"; foreach ($fields_list as $field) { echo '<option value="' . PMA_backquote(htmlspecialchars($field['Field'])) . '"'; if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) { echo ' title="' . htmlspecialchars($field['Comment']) . '"'; } echo '>' . htmlspecialchars($field['Field']) . '</option>' . "\n"; } echo '</select>' . "\n" . '<div id="tablefieldinsertbuttoncontainer">' . "\n"; if ($GLOBALS['cfg']['PropertiesIconic']) { echo '<input type="button" name="insert" value="<<"' . ' onclick="insertValueQuery()"' . ' title="' . $GLOBALS['strInsert'] . '" />' . "\n"; } else { echo '<input type="button" name="insert"' . ' value="' . $GLOBALS['strInsert'] . '"' . ' onclick="insertValueQuery()" />' . "\n"; } echo '</div>' . "\n" . '</div>' . "\n"; } echo '<div class="clearfloat"></div>' . "\n"; echo '</div>' . "\n"; if (!empty($GLOBALS['cfg']['Bookmark']) && $GLOBALS['cfg']['Bookmark']['db'] && $GLOBALS['cfg']['Bookmark']['table']) { ?> <div id="bookmarkoptions"> <div class="formelement"> <label for="bkm_label"> <?php echo $GLOBALS['strBookmarkThis']; ?> :</label> <input type="text" name="bkm_label" id="bkm_label" value="" /> </div> <div class="formelement"> <input type="checkbox" name="bkm_all_users" id="id_bkm_all_users" value="true" /> <label for="id_bkm_all_users"> <?php echo $GLOBALS['strBookmarkAllUsers']; ?> </label> </div> <div class="formelement"> <input type="checkbox" name="bkm_replace" id="id_bkm_replace" value="true" /> <label for="id_bkm_replace"> <?php echo $GLOBALS['strBookmarkReplace']; ?> </label> </div> </div> <?php } echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>' . "\n" . '</div>' . "\n"; echo '<fieldset id="queryboxfooter" class="tblFooters">' . "\n"; echo '<div class="formelement">' . "\n"; if ($is_querywindow) { ?> <script type="text/javascript" language="javascript"> //<![CDATA[ document.writeln(' <input type="checkbox" name="LockFromUpdate" value="1" id="checkbox_lock" /> <label for="checkbox_lock"><?php echo $GLOBALS['strQueryWindowLock']; ?> </label> '); //]]> </script> <?php } echo '</div>' . "\n"; echo '<div class="formelement">' . "\n"; echo '<input type="checkbox" name="show_query" value="1" ' . 'id="checkbox_show_query" checked="checked" />' . "\n" . '<label for="checkbox_show_query">' . $GLOBALS['strShowThisQuery'] . '</label>' . "\n"; echo '</div>' . "\n"; echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo'] . '" />' . "\n"; echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>' . "\n"; }
/** * Returns the names of children of type $type present inside this container * This method is overridden by the Node_Database and Node_Table classes * * @param string $type The type of item we are looking for * ('tables', 'views', etc) * @param int $pos The offset of the list within the results * @param string $searchClause A string used to filter the results of the query * * @return array */ public function getData($type, $pos, $searchClause = '') { $maxItems = $GLOBALS['cfg']['MaxNavigationItems']; $retval = array(); $db = $this->realParent()->real_name; $table = $this->real_name; switch ($type) { case 'columns': if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) { $db = PMA_Util::sqlAddSlashes($db); $table = PMA_Util::sqlAddSlashes($table); $query = "SELECT `COLUMN_NAME` AS `name` "; $query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` "; $query .= "WHERE `TABLE_NAME`='{$table}' "; $query .= "AND `TABLE_SCHEMA`='{$db}' "; $query .= "ORDER BY `COLUMN_NAME` ASC "; $query .= "LIMIT " . intval($pos) . ", {$maxItems}"; $retval = PMA_DBI_fetch_result($query); } else { $db = PMA_Util::backquote($db); $table = PMA_Util::backquote($table); $query = "SHOW COLUMNS FROM {$table} FROM {$db}"; $handle = PMA_DBI_try_query($query); if ($handle !== false) { $count = 0; while ($arr = PMA_DBI_fetch_array($handle)) { if ($pos <= 0 && $count < $maxItems) { $retval[] = $arr['Field']; $count++; } $pos--; } } } break; case 'indexes': $db = PMA_Util::backquote($db); $table = PMA_Util::backquote($table); $query = "SHOW INDEXES FROM {$table} FROM {$db}"; $handle = PMA_DBI_try_query($query); if ($handle !== false) { $count = 0; while ($arr = PMA_DBI_fetch_array($handle)) { if (!in_array($arr['Key_name'], $retval)) { if ($pos <= 0 && $count < $maxItems) { $retval[] = $arr['Key_name']; $count++; } $pos--; } } } break; case 'triggers': if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) { $db = PMA_Util::sqlAddSlashes($db); $table = PMA_Util::sqlAddSlashes($table); $query = "SELECT `TRIGGER_NAME` AS `name` "; $query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` "; $query .= "WHERE `EVENT_OBJECT_SCHEMA`='{$db}' "; $query .= "AND `EVENT_OBJECT_TABLE`='{$table}' "; $query .= "ORDER BY `TRIGGER_NAME` ASC "; $query .= "LIMIT " . intval($pos) . ", {$maxItems}"; $retval = PMA_DBI_fetch_result($query); } else { $db = PMA_Util::backquote($db); $table = PMA_Util::sqlAddSlashes($table); $query = "SHOW TRIGGERS FROM {$db} WHERE `Table` = '{$table}'"; $handle = PMA_DBI_try_query($query); if ($handle !== false) { $count = 0; while ($arr = PMA_DBI_fetch_array($handle)) { if ($pos <= 0 && $count < $maxItems) { $retval[] = $arr['Trigger']; $count++; } $pos--; } } } break; default: break; } return $retval; }
/** * Returns all the grants for a certain user on a certain host * Used in the export privileges for all users section * * @param string $user User name * @param string $host Host name * * @return string containing all the grants text */ function PMA_getGrants($user, $host) { $grants = PMA_DBI_fetch_result("SHOW GRANTS FOR '" . PMA_sqlAddSlashes($user) . "'@'" . PMA_sqlAddSlashes($host) . "'"); $response = ''; foreach ($grants as $one_grant) { $response .= $one_grant . ";\n\n"; } return $response; } // end of the 'PMA_getGrants()' function
/** * returns details about the TRIGGERs for a specific table or database * * @param string $db db name * @param string $table table name * @param string $delimiter the delimiter to use (may be empty) * * @return array information about triggers (may be empty) */ function PMA_DBI_get_triggers($db, $table = '', $delimiter = '//') { $common_functions = PMA_CommonFunctions::getInstance(); if (PMA_DRIZZLE) { // Drizzle doesn't support triggers return array(); } $result = array(); if (!$GLOBALS['cfg']['Server']['DisableIS']) { // Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html // their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this // instead of WHERE EVENT_OBJECT_SCHEMA='dbname' $query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION' . ', EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT' . ', EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER' . ' FROM information_schema.TRIGGERS' . ' WHERE TRIGGER_SCHEMA= \'' . $common_functions->sqlAddSlashes($db) . '\''; if (!empty($table)) { $query .= " AND EVENT_OBJECT_TABLE = '" . $common_functions->sqlAddSlashes($table) . "';"; } } else { $query = "SHOW TRIGGERS FROM " . $common_functions->backquote($db); if (!empty($table)) { $query .= " LIKE '" . $common_functions->sqlAddSlashes($table, true) . "';"; } } if ($triggers = PMA_DBI_fetch_result($query)) { foreach ($triggers as $trigger) { if ($GLOBALS['cfg']['Server']['DisableIS']) { $trigger['TRIGGER_NAME'] = $trigger['Trigger']; $trigger['ACTION_TIMING'] = $trigger['Timing']; $trigger['EVENT_MANIPULATION'] = $trigger['Event']; $trigger['EVENT_OBJECT_TABLE'] = $trigger['Table']; $trigger['ACTION_STATEMENT'] = $trigger['Statement']; $trigger['DEFINER'] = $trigger['Definer']; } $one_result = array(); $one_result['name'] = $trigger['TRIGGER_NAME']; $one_result['table'] = $trigger['EVENT_OBJECT_TABLE']; $one_result['action_timing'] = $trigger['ACTION_TIMING']; $one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION']; $one_result['definition'] = $trigger['ACTION_STATEMENT']; $one_result['definer'] = $trigger['DEFINER']; // do not prepend the schema name; this way, importing the // definition into another schema will work $one_result['full_trigger_name'] = $common_functions->backquote($trigger['TRIGGER_NAME']); $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' . $one_result['full_trigger_name']; $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING'] . ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . $common_functions->backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n"; $result[] = $one_result; } } // Sort results by name $name = array(); foreach ($result as $key => $value) { $name[] = $value['name']; } array_multisort($name, SORT_ASC, $result); return $result; }
} unset($reread_info); /** * Displays top menu links */ require_once './libraries/tbl_links.inc.php'; $url_params['goto'] = 'tbl_operations.php'; $url_params['back'] = 'tbl_operations.php'; /** * Get columns names */ $local_query = ' SHOW COLUMNS FROM ' . PMA_backquote($GLOBALS['table']) . ' FROM ' . PMA_backquote($GLOBALS['db']); $columns = PMA_DBI_fetch_result($local_query, null, 'Field'); unset($local_query); /** * Displays the page */ ?> <!-- Order the table --> <div id="div_table_order"> <form method="post" action="tbl_operations.php"> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?> <fieldset id="fieldset_table_order"> <legend><?php echo $strAlterOrderBy; ?>
/** * returns details about the TRIGGERs of a specific table * * @uses PMA_DBI_fetch_result() * @param string $db db name * @param string $table table name * @param string $delimiter the delimiter to use (may be empty) * * @return array information about triggers (may be empty) */ function PMA_DBI_get_triggers($db, $table, $delimiter = '//') { $result = array(); if (!$GLOBALS['cfg']['Server']['DisableIS']) { // Note: in http://dev.mysql.com/doc/refman/5.0/en/faqs-triggers.html // their example uses WHERE TRIGGER_SCHEMA='dbname' so let's use this // instead of WHERE EVENT_OBJECT_SCHEMA='dbname' $triggers = PMA_DBI_fetch_result("SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION, ACTION_TIMING, ACTION_STATEMENT, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA= '" . PMA_sqlAddslashes($db, true) . "' and EVENT_OBJECT_TABLE = '" . PMA_sqlAddslashes($table, true) . "';"); } else { $triggers = PMA_DBI_fetch_result("SHOW TRIGGERS FROM " . PMA_sqlAddslashes($db, true) . " LIKE '" . PMA_sqlAddslashes($table, true) . "';"); } if ($triggers) { foreach ($triggers as $trigger) { if ($GLOBALS['cfg']['Server']['DisableIS']) { $trigger['TRIGGER_NAME'] = $trigger['Trigger']; $trigger['ACTION_TIMING'] = $trigger['Timing']; $trigger['EVENT_MANIPULATION'] = $trigger['Event']; $trigger['EVENT_OBJECT_TABLE'] = $trigger['Table']; $trigger['ACTION_STATEMENT'] = $trigger['Statement']; } $one_result = array(); $one_result['name'] = $trigger['TRIGGER_NAME']; $one_result['action_timing'] = $trigger['ACTION_TIMING']; $one_result['event_manipulation'] = $trigger['EVENT_MANIPULATION']; // do not prepend the schema name; this way, importing the // definition into another schema will work $one_result['full_trigger_name'] = PMA_backquote($trigger['TRIGGER_NAME']); $one_result['drop'] = 'DROP TRIGGER IF EXISTS ' . $one_result['full_trigger_name']; $one_result['create'] = 'CREATE TRIGGER ' . $one_result['full_trigger_name'] . ' ' . $trigger['ACTION_TIMING'] . ' ' . $trigger['EVENT_MANIPULATION'] . ' ON ' . PMA_backquote($trigger['EVENT_OBJECT_TABLE']) . "\n" . ' FOR EACH ROW ' . $trigger['ACTION_STATEMENT'] . "\n" . $delimiter . "\n"; $result[] = $one_result; } } return $result; }
/** * this is just a backup, if all is fine this can be deleted later * * @deprecated */ protected function _checkAgainstPrivTables() { // 1. get allowed dbs from the "mysql.db" table // lem9: User can be blank (anonymous user) $local_query = " SELECT DISTINCT `Db` FROM `mysql`.`db` WHERE `Select_priv` = 'Y' AND `User` IN ('" . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . "', '')"; $tmp_mydbs = PMA_DBI_fetch_result($local_query, null, null, $GLOBALS['controllink']); if ($tmp_mydbs) { // Will use as associative array of the following 2 code // lines: // the 1st is the only line intact from before // correction, // the 2nd replaces $dblist[] = $row['Db']; // Code following those 2 lines in correction continues // populating $dblist[], as previous code did. But it is // now populated with actual database names instead of // with regular expressions. $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $GLOBALS['controllink']); // loic1: all databases cases - part 2 if (isset($tmp_mydbs['%'])) { while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) { $dblist[] = $tmp_row[0]; } // end while } else { while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) { $tmp_db = $tmp_row[0]; if (isset($tmp_mydbs[$tmp_db]) && $tmp_mydbs[$tmp_db] == 1) { $dblist[] = $tmp_db; $tmp_mydbs[$tmp_db] = 0; } elseif (!isset($dblist[$tmp_db])) { foreach ($tmp_mydbs as $tmp_matchpattern => $tmp_value) { // loic1: fixed bad regexp // TODO: db names may contain characters // that are regexp instructions $re = '(^|(\\\\\\\\)+|[^\])'; $tmp_regex = preg_replace('/' . addcslashes($re,'/') . '%/', '\\1.*', preg_replace('/' . addcslashes($re,'/') . '_/', '\\1.{1}', $tmp_matchpattern)); // Fixed db name matching // 2000-08-28 -- Benjamin Gandon if (preg_match('/^' . addcslashes($tmp_regex,'/') . '$/', $tmp_db)) { $dblist[] = $tmp_db; break; } } // end while } // end if ... elseif ... } // end while } // end else PMA_DBI_free_result($tmp_alldbs); unset($tmp_mydbs); } // end if // 2. get allowed dbs from the "mysql.tables_priv" table $local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($GLOBALS['cfg']['Server']['user']) . '\''; $rs = PMA_DBI_try_query($local_query, $GLOBALS['controllink']); if ($rs && @PMA_DBI_num_rows($rs)) { while ($row = PMA_DBI_fetch_assoc($rs)) { if (!in_array($row['Db'], $dblist)) { $dblist[] = $row['Db']; } } // end while PMA_DBI_free_result($rs); } // end if }
/** * Get the database rigths array for Display user overview * * @return array $db_rights database rights array */ function PMA_getDbRightsForUserOverview() { // we also want users not in table `user` but in other table $tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;'); $tables_to_search_for_users = array('user', 'db', 'tables_priv', 'columns_priv', 'procs_priv'); $db_rights_sqls = array(); foreach ($tables_to_search_for_users as $table_search_in) { if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' . (isset($_GET['initial']) ? PMA_rangeOfUsers($_GET['initial']) : ''); } } $user_defaults = array('User' => '', 'Host' => '%', 'Password' => '?', 'Grant_priv' => 'N', 'privs' => array('USAGE')); // for the rights $db_rights = array(); $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')' . ' ORDER BY `User` ASC, `Host` ASC'; $db_rights_result = PMA_DBI_query($db_rights_sql); while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { $db_rights_row = array_merge($user_defaults, $db_rights_row); $db_rights[$db_rights_row['User']][$db_rights_row['Host']] = $db_rights_row; } PMA_DBI_free_result($db_rights_result); ksort($db_rights); return $db_rights; }
/** * Gets the mimetypes for all columns of a table * * @uses $GLOBALS['controllink'] * @uses PMA_getRelationsParam() * @uses PMA_backquote() * @uses PMA_sqlAddslashes() * @uses PMA_DBI_fetch_result() * @author Mike Beck <*****@*****.**> * @author Garvin Hicking <*****@*****.**> * @access public * @param string $db the name of the db to check for * @param string $table the name of the table to check for * @param string $strict whether to include only results having a mimetype set * @return array [field_name][field_key] = field_value */ function PMA_getMIME($db, $table, $strict = false) { $cfgRelation = PMA_getRelationsParam(); if (!$cfgRelation['commwork']) { return false; } $com_qry = ' SELECT `column_name`, `mimetype`, `transformation`, `transformation_options` FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' WHERE `db_name` = \'' . PMA_sqlAddslashes($db) . '\' AND `table_name` = \'' . PMA_sqlAddslashes($table) . '\' AND ( `mimetype` != \'\'' . (!$strict ? ' OR `transformation` != \'\' OR `transformation_options` != \'\'' : '') . ')'; return PMA_DBI_fetch_result($com_qry, 'column_name', null, $GLOBALS['controllink']); }
/** * Displays top menu links */ require_once './libraries/tbl_links.inc.php'; /** * Get the analysis of SHOW CREATE TABLE for this table * @todo should be handled by class Table */ $show_create_table = PMA_DBI_fetch_value('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0, 1); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); unset($show_create_table); /** * Get the list of the fields of the current table */ PMA_DBI_select_db($db); $table_fields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, null, null, PMA_DBI_QUERY_STORE); $rows = array(); if (isset($where_clause)) { // when in edit mode load all selected rows from table $insert_mode = false; if (is_array($where_clause)) { $where_clause_array = $where_clause; } else { $where_clause_array = array(0 => $where_clause); } $result = array(); $found_unique_key = false; $where_clauses = array(); foreach ($where_clause_array as $key_id => $where_clause) { $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';'; $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
/** * Outputs database footer * * @param string $db Database name * * @return bool Whether it succeeded */ public function exportDBFooter($db) { global $crlf; $result = true; if (isset($GLOBALS['sql_constraints'])) { $result = PMA_exportOutputHandler($GLOBALS['sql_constraints']); unset($GLOBALS['sql_constraints']); } if (($GLOBALS['sql_structure_or_data'] == 'structure' || $GLOBALS['sql_structure_or_data'] == 'structure_and_data') && isset($GLOBALS['sql_procedure_function'])) { $text = ''; $delimiter = '$$'; if (PMA_MYSQL_INT_VERSION > 50100) { $event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE' . ' EVENT_SCHEMA= \'' . PMA_Util::sqlAddSlashes($db, true) . '\';'); } else { $event_names = array(); } if ($event_names) { $text .= $crlf . 'DELIMITER ' . $delimiter . $crlf; $text .= $this->_exportComment() . $this->_exportComment(__('Events')) . $this->_exportComment(); foreach ($event_names as $event_name) { if (!empty($GLOBALS['sql_drop_table'])) { $text .= 'DROP EVENT ' . PMA_Util::backquote($event_name) . $delimiter . $crlf; } $text .= PMA_DBI_get_definition($db, 'EVENT', $event_name) . $delimiter . $crlf . $crlf; } $text .= 'DELIMITER ;' . $crlf; } if (!empty($text)) { $result = PMA_exportOutputHandler($text); } } return $result; }
/** * Get list of replicated databases on master server * * @param mixed mysql link * * @return array array of replicated databases */ function PMA_replication_master_replicated_dbs($link = null) { $data = PMA_DBI_fetch_result('SHOW MASTER STATUS', null, null, $link); // let's find out, which databases are replicated $do_db = array(); $ignore_db = array(); if (!empty($data[0]['Binlog_Do_DB'])) { $do_db = explode(',', $data[0]['Binlog_Do_DB']); } if (!empty($data[0]['Binlog_Ignore_DB'])) { $ignore_db = explode(',', $data[0]['Binlog_Ignore_DB']); } $tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link); while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) { if ($tmp_row[0] == 'information_schema') { continue; } if (count($do_db) == 0) { if (array_search($tmp_row[0], $ignore_db) !== false) { continue; } $dblist[] = $tmp_row[0]; } else { if (array_search($tmp_row[0], $do_db) !== false) { $dblist[] = $tmp_row[0]; } } } // end while return $link; }
/** * Get all columns * * returns an array with all columns * * @param bool $backquoted whether to quote name with backticks `` * * @return array */ public function getColumns($backquoted = true) { $sql = 'SHOW COLUMNS FROM ' . $this->getFullName(true); $indexed = PMA_DBI_fetch_result($sql, 'Field', 'Field'); $return = array(); foreach ($indexed as $column) { $return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column); } return $return; }
/** * Displays the sub-page heading */ echo '<h2>' . "\n" . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_vars.png" width="16" height="16" alt="" />' : '') . '' . $strServerVars . "\n" . '</h2>' . "\n"; /** * Sends the queries and buffers the results */ $serverVars = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1); $serverVarsGlobal = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1); /** * Displays the page */ ?> <table class="data"> <thead> <tr><th><?php echo $strVar; ?></th> <th> <?php echo $strSessionValue . ' / ' . $strGlobalValue; ?> </th> </tr>
/** * array PMA_get_column_values (string $database, string $table, string $column , mysql db link $link = null) * * @param string $database name of database * @param string $table name of table to retrieve columns from * @param string $column name of the column to retrieve data from * @param mixed $link mysql link resource * * @return array $field_values */ function PMA_get_column_values($database, $table, $column, $link = null) { $query = 'SELECT '; for ($i = 0; $i < sizeof($column); $i++) { $query .= PMA_backquote($column[$i]); if ($i < sizeof($column) - 1) { $query .= ', '; } } $query .= ' FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table); $field_values = PMA_DBI_fetch_result($query, null, null, $link); if (!is_array($field_values) || count($field_values) < 1) { return false; } return $field_values; }