From f5fbdf9699487125628466d710a8b097a2ed1b17 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Sun, 21 Jun 2009 23:45:42 +0000 Subject: [PATCH] Disable foreign_key_checks only with several tables git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@738 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/db.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 24f72f74..6b96c5b5 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -4,7 +4,9 @@ $tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]); if ($tables_views && !$error) { $result = true; $message = ""; - $dbh->query("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once + if (count((array) $_POST["tables"]) > 1) { + $dbh->query("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once + } if (isset($_POST["truncate"])) { if ($_POST["tables"]) { foreach ($_POST["tables"] as $table) {