Use $row instead of $data
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@194 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
51e0b6418a
commit
f2cfe8c68d
18
edit.inc.php
18
edit.inc.php
|
@ -39,9 +39,9 @@ page_header((isset($_GET["default"]) ? lang('Default values') : ($_GET["where"]
|
||||||
|
|
||||||
if ($_POST) {
|
if ($_POST) {
|
||||||
echo "<p class='error'>" . lang('Error during saving') . ": " . htmlspecialchars($error) . "</p>\n";
|
echo "<p class='error'>" . lang('Error during saving') . ": " . htmlspecialchars($error) . "</p>\n";
|
||||||
$data = (array) $_POST["fields"];
|
$row = (array) $_POST["fields"];
|
||||||
foreach ((array) $_POST["null"] as $key => $val) {
|
foreach ((array) $_POST["null"] as $key => $val) {
|
||||||
$data[$key] = null;
|
$row[$key] = null;
|
||||||
}
|
}
|
||||||
} elseif ($where) {
|
} elseif ($where) {
|
||||||
$select = array();
|
$select = array();
|
||||||
|
@ -52,12 +52,12 @@ if ($_POST) {
|
||||||
}
|
}
|
||||||
if ($select) {
|
if ($select) {
|
||||||
$result = $mysql->query("SELECT " . implode(", ", $select) . " FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1");
|
$result = $mysql->query("SELECT " . implode(", ", $select) . " FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1");
|
||||||
$data = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
} else {
|
} else {
|
||||||
$data = array();
|
$row = array();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unset($data);
|
unset($row);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -67,12 +67,12 @@ if ($fields) {
|
||||||
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
echo "<tr><th>" . htmlspecialchars($name) . "</th><td>";
|
echo "<tr><th>" . htmlspecialchars($name) . "</th><td>";
|
||||||
if (!isset($data)) {
|
if (!isset($row)) {
|
||||||
$value = $field["default"];
|
$value = $field["default"];
|
||||||
} elseif (strlen($data[$name]) && ($field["type"] == "enum" || $field["type"] == "set")) {
|
} elseif (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set")) {
|
||||||
$value = intval($data[$name]);
|
$value = intval($row[$name]);
|
||||||
} else {
|
} else {
|
||||||
$value = $data[$name];
|
$value = $row[$name];
|
||||||
}
|
}
|
||||||
input($name, $field, $value);
|
input($name, $field, $value);
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
|
|
Loading…
Reference in a new issue