'; } else { $iconic_spacer = ''; } $titles['Browse'] = $iconic_spacer . '' . $strBrowseForeignValues . ''; if ($propicon == 'both') { $titles['Browse'] .= ' ' . $strBrowseForeignValues . ''; } } else { $titles['Browse'] = $strBrowseForeignValues; } /** * Defines arrays of functions (should possibly be in config.inc.php * so it can also be used in tbl_qbe.php) * * LIKE works also on integers and dates so I added it in numfunctions */ $numfunctions = array('=', '>', '>=', '<', '<=', '!=', 'LIKE', 'NOT LIKE'); $textfunctions = array('LIKE', 'NOT LIKE', '=', '!='); $enumfunctions = array('=', '!='); $nullfunctions = array('IS NULL', 'IS NOT NULL'); $unaryfunctions = array( 'IS NULL' => 1, 'IS NOT NULL' => 1); /** * Not selection yet required -> displays the selection form */ if (!isset($param) || $param[0] == '') { // Gets some core libraries require('./tbl_properties_common.php'); //$err_url = 'tbl_select.php' . $err_url; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; require('./tbl_properties_table_info.php'); if (!isset($goto)) { $goto = $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); 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 { $type = str_replace(array('binary', 'zerofill', 'unsigned'), '', strtolower($type)); } if (empty($type)) { $type = ' '; } $fields_null[] = $row['Null']; $fields_type[] = $type; if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($row['Collation']) && $row['Collation'] != 'NULL') { $fields_collation[] = $row['Collation']; $tmp_charset = explode('_', $row['Collation']); $fields_charset[] = $tmp_charset[0]; unset($tmp_charset); } else { $fields_collation[] = $fields_charset[] = ''; } } // end while PMA_DBI_free_result($result); unset($result, $type); // // 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); ?>



    
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 { $sql_query .= PMA_backquote(urldecode($param[0])); $c = count($param); for ($i = 1; $i < $c; $i++) { $sql_query .= ',' . PMA_backquote(urldecode($param[$i])); } } // end if $sql_query .= ' FROM ' . PMA_backquote($table); // The where clause if (trim($where) != '') { $sql_query .= ' WHERE ' . $where; } else { $w = array(); $cnt_func = count($func); reset($func); while (list($i, $func_type) = each($func)) { if (@$unaryfunctions[$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]) . '\''; for ($e = 1; $e < $enum_selected_count; $e++) { $enum_where .= ', \'' . PMA_sqlAddslashes($fields[$i][$e]) . '\''; } $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close; } } elseif ($fields[$i] != '') { if (preg_match('@char|blob|text|set|date|time|year@i', $types[$i])) { $quot = '\''; } else { $quot = ''; } $w[] = PMA_backquote(urldecode($names[$i])) . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields[$i]) . $quot; } // 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'); } ?>