add field list on the query page

This commit is contained in:
Marc Delisle
2002-07-01 19:47:32 +00:00
parent 2bd6207caf
commit a8faed8757
2 changed files with 26 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ $Source$
2002-07-01 Marc Delisle <lem9@users.sourceforge.net>
* tbl_properties_links.php3, db_details_links.php3: better vertical spacing
* tbl_properties.php3, db_details.php3: misplaced bullet
* tbl_properties.php3: add field list on the query page
2002-07-01 Alexander M. Turek <rabus@users.sourceforge.net>
* sql.php3: Fixed bug #575867 (Error with limit or load in the table name).

View File

@@ -30,6 +30,21 @@ if (isset($show_query) && $show_query == 'y') {
}
unset($sql_query);
/*
* Get the list and number of fields
*/
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
$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'];
} // end while
mysql_free_result($result);
}
/**
* Work on the table
@@ -63,7 +78,16 @@ require('./tbl_properties_table_info.php3');
<input type="hidden" name="goto" value="tbl_properties.php3" />
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showDocuShort('S/E/SELECT.html'); ?>&nbsp;:<br />
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showDocuShort('S/E/SELECT.html') . '&nbsp;&nbsp;&nbsp;' . $strFields . ':'; ?>
<select name="dummy[]" size="1">
<?php
echo "\n";
for ($i = 0 ; $i < $fields_cnt; $i++) {
echo ' <option value="' . urlencode($fields_list[$i]) . '" se
lected="selected">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
}
?>
</select><br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" wrap="virtual"
onfocus="if (typeof(document.layers) == 'undefined' || typeof(textarea_selected) == 'undefined') {textarea_selected = 1; this.form.elements['sql_query'].select();}">