';
} else {
$iconic_spacer = '';
}
$titles['Browse'] = $iconic_spacer . '';
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');
$textfunctions = array('LIKE', '=', '!=');
/**
* 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
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
$result = @PMA_mysql_query($local_query);
if (!$result) {
PMA_mysqlDie('', $local_query, '', $err_url);
}
else {
$fields_cnt = mysql_num_rows($result);
while ($row = PMA_mysql_fetch_array($result)) {
$fields_list[] = $row['Field'];
$type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001
$shorttype = substr($type, 0, 3);
if ($shorttype == 'set' || $shorttype == 'enu') {
$type = str_replace(',', ', ', $type);
} else {
$type = preg_replace('@BINARY@i', '', $type);
$type = preg_replace('@ZEROFILL@i', '', $type);
$type = preg_replace('@UNSIGNED@i', '', $type);
}
if (empty($type)) {
$type = ' ';
}
$fields_type[] = $type;
} // end while
mysql_free_result($result);
//
// 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 ';
// 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]));
$i = 0;
$c = count($param);
while ($i < $c) {
if ($i > 0) {
$sql_query .= ',' . PMA_backquote(urldecode($param[$i]));
}
$i++;
}
} // end if
$sql_query .= ' FROM ' . PMA_backquote($table);
// The where clause
if ($where != '') {
$sql_query .= ' WHERE ' . $where;
}
else {
$sql_query .= ' WHERE 1';
$cnt_fields = count($fields);
for ($i = 0; $i < $cnt_fields; $i++) {
if (!empty($fields) && $fields[$i] != '') {
if (preg_match('@char|blob|text|set|enum|date|time|year@i', $types[$i])) {
$quot = '\'';
} else {
$quot = '';
}
if (strtoupper($fields[$i]) == 'NULL' || strtoupper($fields[$i]) == 'NOT NULL') {
$quot = '';
$func[$i] = 'IS';
}
//$sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . " $func[$i] $quot$fields[$i]$quot";
$sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . ' ' . $func[$i] . ' ' . $quot . PMA_sqlAddslashes($fields[$i]) . $quot;
} // end if
} // end for
} // end if
if ($orderField != '--nil--') {
$sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order;
} // end if
include('./sql.php');
}
?>