Saving uses $where
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@35 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
1fb9063c7c
commit
a5a6d3b381
22
edit.inc.php
22
edit.inc.php
|
@ -1,5 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
$fields = fields($_GET["edit"]);
|
$fields = fields($_GET["edit"]);
|
||||||
|
$where = array();
|
||||||
|
if (is_array($_GET["where"])) {
|
||||||
|
foreach ($_GET["where"] as $key => $val) {
|
||||||
|
$where[] = idf_escape($key) . " = BINARY '" . mysql_real_escape_string($val) . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_array($_GET["null"])) {
|
||||||
|
foreach ($_GET["null"] as $key) {
|
||||||
|
$where[] = idf_escape($key) . " IS NULL";
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($_POST) {
|
if ($_POST) {
|
||||||
if (isset($_POST["delete"])) {
|
if (isset($_POST["delete"])) {
|
||||||
$query = "DELETE FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1";
|
$query = "DELETE FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1";
|
||||||
|
@ -33,17 +44,6 @@ if ($_POST) {
|
||||||
}
|
}
|
||||||
page_header(($_GET["where"] ? lang('Edit') : lang('Insert')) . ": " . htmlspecialchars($_GET["edit"]));
|
page_header(($_GET["where"] ? lang('Edit') : lang('Insert')) . ": " . htmlspecialchars($_GET["edit"]));
|
||||||
|
|
||||||
$where = array();
|
|
||||||
if (is_array($_GET["where"])) {
|
|
||||||
foreach ($_GET["where"] as $key => $val) {
|
|
||||||
$where[] = idf_escape($key) . " = BINARY '" . mysql_real_escape_string($val) . "'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (is_array($_GET["null"])) {
|
|
||||||
foreach ($_GET["null"] as $key) {
|
|
||||||
$where[] = idf_escape($key) . " IS NULL";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 = $_POST["fields"];
|
$data = $_POST["fields"];
|
||||||
|
|
Loading…
Reference in a new issue