aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-02-26 09:24:24 +0100
committerThomas Lange <code@nerdmind.de>2017-02-26 09:24:24 +0100
commitd83515b31ff5dcee19e9d31a04134619503d6f61 (patch)
tree60d31ab57ff89c90266e7b8b8036cfc931e73e53
parent63c97d4721c3869320d4c5c05ce8c8d66bec1fbf (diff)
downloadblog-d83515b31ff5dcee19e9d31a04134619503d6f61.tar.gz
blog-d83515b31ff5dcee19e9d31a04134619503d6f61.tar.xz
blog-d83515b31ff5dcee19e9d31a04134619503d6f61.zip
Added support for multiple queries in a single request.
-rw-r--r--admin/database.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/admin/database.php b/admin/database.php
index 47ffd29..451e475 100644
--- a/admin/database.php
+++ b/admin/database.php
@@ -16,7 +16,10 @@ require_once '../core/application.php';
if(HTTP::issetPOST(['token' => Application::getSecurityToken()], 'command')) {
try {
$Statement = $Database->query(HTTP::POST('command'));
- $result = print_r($Statement->fetchAll(), TRUE);
+
+ do {
+ $result[] = print_r($Statement->fetchAll(), TRUE);
+ } while($Statement->nextRowset());
} catch(PDOException $Exception) {
$messages[] = $Exception->getMessage();
}
@@ -30,7 +33,7 @@ try {
$DatabaseTemplate->set('FORM', [
'INFO' => $messages ?? [],
'TOKEN' => Application::getSecurityToken(),
- 'RESULT' => $result ?? NULL,
+ 'RESULT' => implode(NULL, $result ?? []),
'COMMAND' => HTTP::POST('command'),
]);