Use default type length
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@22 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
24b5e25f4b
commit
ccadcbec33
|
@ -27,7 +27,7 @@ if ($_POST) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mysql_query($query)) {
|
if (mysql_query($query)) {
|
||||||
redirect($SELF . "select=" . urlencode($_GET["edit"]), $message);
|
redirect($SELF . ($_POST["insert"] ? "edit=" : "select=") . urlencode($_GET["edit"]), $message);
|
||||||
}
|
}
|
||||||
$error = mysql_error();
|
$error = mysql_error();
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ if ($_POST) {
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<table border='1' cellspacing='0' cellpadding='2'>
|
<table border='1' cellspacing='0' cellpadding='2'>
|
||||||
<?php
|
<?php
|
||||||
|
$types = types();
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
echo "<tr><th>" . htmlspecialchars($name) . "</th><td>";
|
echo "<tr><th>" . htmlspecialchars($name) . "</th><td>";
|
||||||
$value = ($data ? $data[$name] : $field["default"]);
|
$value = ($data ? $data[$name] : $field["default"]);
|
||||||
|
@ -90,14 +91,14 @@ foreach ($fields as $name => $field) {
|
||||||
} elseif (strpos($field["type"], "text") !== false) {
|
} elseif (strpos($field["type"], "text") !== false) {
|
||||||
echo '<textarea name="fields[' . $name . ']" cols="50" rows="12">' . htmlspecialchars($value) . '</textarea>';
|
echo '<textarea name="fields[' . $name . ']" cols="50" rows="12">' . htmlspecialchars($value) . '</textarea>';
|
||||||
} else { //! numbers, date, binary
|
} else { //! numbers, date, binary
|
||||||
echo '<input name="fields[' . $name . ']" value="' . htmlspecialchars($value) . '"' . (strlen($field["length"]) ? " maxlength='$field[length]'" : '') . ' />';
|
echo '<input name="fields[' . $name . ']" value="' . htmlspecialchars($value) . '"' . (strlen($field["length"]) ? " maxlength='$field[length]'" : ($types[$field["type"]] ? " maxlength='" . $types[$field["type"]] . "'" : '')) . ' />';
|
||||||
}
|
}
|
||||||
if ($field["null"] && preg_match('~char|text|set~', $field["type"])) {
|
if ($field["null"] && preg_match('~char|text|set~', $field["type"])) {
|
||||||
echo '<input type="checkbox" name="null[' . $name . ']" value="1" id="null-' . $name . '"' . (isset($value) ? '' : ' checked="checked"') . ' /><label for="null-' . $name . '">' . lang('NULL') . '</label>';
|
echo '<input type="checkbox" name="null[' . $name . ']" value="1" id="null-' . $name . '"' . (isset($value) ? '' : ' checked="checked"') . ' /><label for="null-' . $name . '">' . lang('NULL') . '</label>';
|
||||||
}
|
}
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
}
|
}
|
||||||
echo "<tr><th></th><td><input type='submit' value='" . lang('Save') . "' />" . ($where ? " <input type='submit' name='delete' value='" . lang('Delete') . "' />" : "") . "</td></tr>\n";
|
echo "<tr><th></th><td><input type='submit' value='" . lang('Save') . "' /> <input type='submit' name='insert' value='" . lang('Save and insert') . "' />" . ($where ? " <input type='submit' name='delete' value='" . lang('Delete') . "' />" : "") . "</td></tr>\n";
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue