displays the selection form */ if (! isset($param) || $param[0] == '') { // Gets some core libraries include_once 'libraries/tbl_common.php'; //$err_url = 'tbl_select.php' . $err_url; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; /** * Gets tables informations */ include_once 'libraries/tbl_info.inc.php'; /** * Displays top menu links */ include_once 'libraries/tbl_links.inc.php'; if (! isset($goto)) { $goto = $GLOBALS['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 list($fields_list, $fields_type, $fields_collation, $fields_null, $geom_column_present) = PMA_tbl_getFields($db, $table); $fields_cnt = count($fields_list); // retrieve keys into foreign fields, if any // check also foreigners even if relwork is FALSE (to get // foreign keys from innodb) $foreigners = PMA_getForeigners($db, $table); ?>
do the work */ // 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); } // end if // avoid a loop, for example when $cfg['DefaultTabTable'] is set // to 'tbl_select.php' unset($param); $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)) { list($charsets[$i]) = explode('_', $collations[$i]); $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false; $tmp_geom_func = isset($geom_func[$i]) ? $geom_func[$i] : null; $whereClause = PMA_tbl_search_getWhereClause($fields[$i], $names[$i], $types[$i], $collations[$i], $func_type, $unaryFlag, $tmp_geom_func); if($whereClause) $w[] = $whereClause; } // end for if ($w) { $sql_query .= ' WHERE ' . implode(' AND ', $w); } } // end if if ($orderField != '--nil--') { $sql_query .= ' ORDER BY ' . PMA_backquote($orderField) . ' ' . $order; } // end if include 'sql.php'; } ?>