displays the selection form */ if (!isset($param) || $param[0] == '') { include('./header.inc.php3'); // Gets the list and number of fields $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); $result = @mysql_query($local_query); if (!$result) { PMA_mysqlDie('', $local_query, '', $err_url); } else { $fields_cnt = mysql_num_rows($result); while ($row = 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 = eregi_replace(',', ', ', $type); // Removes automatic MySQL escape format $type = str_replace('\'\'', '\\\'', $type); } $type = eregi_replace('BINARY', '', $type); $type = eregi_replace('ZEROFILL', '', $type); $type = eregi_replace('UNSIGNED', '', $type); if (empty($type)) { $type = ' '; } $fields_type[] = $type; } // end while mysql_free_result($result); ?>
       :
     
    
do the work */ else { // Builds the query $sql_query = 'SELECT ' . PMA_backquote(urldecode($param[0])); $i = 0; $c = count($param); while ($i < $c) { if ($i > 0) { $sql_query .= ',' . PMA_backquote(urldecode($param[$i])); } $i++; } $sql_query .= ' FROM ' . PMA_backquote($table); // The where clause if ($where != '') { $sql_query .= ' WHERE ' . ((get_magic_quotes_gpc()) ? stripslashes($where) : $where); } else { $sql_query .= ' WHERE 1'; for ($i = 0; $i < count($fields); $i++) { if (!empty($fields) && $fields[$i] != '') { if (strtoupper($fields[$i]) == 'NULL' || strtoupper($fields[$i]) == 'NOT NULL') { $quot = ''; $cmp = 'IS'; } else if (eregi('char|blob|text', $types[$i]) || eregi('(set|enum)[(]', $types[$i])) { $quot = '\''; $cmp = 'LIKE'; if (get_magic_quotes_gpc()) { $fields[$i] = stripslashes($fields[$i]); } $fields[$i] = PMA_sqlAddslashes($fields[$i], TRUE); } else if (eregi('date|time|year', $types[$i])) { $quot = '\''; $cmp = '='; } else if (strstr($fields[$i], '%')) { $quot = '\''; $cmp = 'LIKE'; } else if (substr($fields[$i], 0, 1) == '<' || substr($fields[$i], 0, 1) == '>') { $quot = ''; $cmp = ''; } else { $quot = ''; $cmp = '='; } // end if $sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . " $cmp $quot$fields[$i]$quot"; } // end if } // end for } // end if if ($orderField != '--nil--') { $sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order; } // end if $url_query = 'lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) . '&sql_query=' . urlencode($sql_query) . '&pos=0' . '&session_max_rows=' . $session_max_rows . '&goto='. $goto; header('Location: ' . $cfgPmaAbsoluteUri . 'sql.php3?' . $url_query); } ?>