Export only selected columns

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@678 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-06-13 17:20:29 +00:00
parent f81740967f
commit 00ae3cce49
2 changed files with 25 additions and 22 deletions

View File

@@ -72,12 +72,13 @@ if ($_POST && !$error) {
if ($_POST["export"]) {
dump_headers($_GET["select"]);
dump_table($_GET["select"], "");
$from = "SELECT " . ($select ? implode(", ", $select) : "*") . " FROM " . idf_escape($_GET["select"]);
if (is_array($_POST["check"])) {
foreach ($_POST["check"] as $val) {
dump_data($_GET["select"], "INSERT", "FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", where_check($val)) . " LIMIT 1");
dump_data($_GET["select"], "INSERT", "$from WHERE " . implode(" AND ", where_check($val)) . " LIMIT 1");
}
} else {
dump_data($_GET["select"], "INSERT", ($where ? "FROM " . idf_escape($_GET["select"]) . " WHERE " . implode(" AND ", $where) : ""));
dump_data($_GET["select"], "INSERT", $from . ($where ? " WHERE " . implode(" AND ", $where) : ""));
}
exit;
}