echo "<table cellspacing='0'>\n";
foreach ($fields as $name => $field) {
echo "<tr><th>" . htmlspecialchars($name) . "</th>";
- $value = (!isset($row) ? ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : null))
- : (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$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))
);
input($name, $field, $value);
if (isset($_GET["default"]) && $field["type"] == "timestamp") {
if ($field["null"] || isset($_GET["default"])) {
array_unshift($options, "NULL");
}
- echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, (isset($value) ? (string) $_POST["function"][$name] : null)) . '</select>' : " ") . '</td><td>';
+ echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, ($value === false ? null : (isset($value) ? (string) $_POST["function"][$name] : 'NULL'))) . '</select>' : " ") . '</td><td>';
if ($field["type"] == "set") { //! 64 bits
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {