Respect default values (thanks to Jiri Pospisil)

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@833 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-07-15 13:41:36 +00:00
parent 572d86caa9
commit 36f430e3df

View file

@ -76,7 +76,7 @@ if ($fields) {
echo "<tr><th>" . adminer_field_name($fields, $name);
$value = (isset($row)
? (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
: ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : false))
: ($_POST["clone"] && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : $field["default"]))
);
$function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($field[($where ? "on_update" : "default")] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : (isset($value) ? '' : 'NULL'))));
input($name, $field, $value, $function);