From: Jakub Vrana Date: Sat, 11 Jan 2014 23:16:26 +0000 (-0800) Subject: MongoDB: Fix insert form with empty table X-Git-Tag: v4.0.3~22 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=4bab88a1a0b3f85ef699f0bdfb0fbafda6730d8a;p=adminer.git MongoDB: Fix insert form with empty table --- diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index 2a6f0a16..faa3434d 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -100,8 +100,13 @@ if ($_POST["save"]) { if (!support("table") && !$fields) { $id = ($jush == "mongo" ? "_id" : "itemName()"); // simpledb if (!$where) { // insert - $row = $driver->select($TABLE, array("*"), $where, array("*"), array(), 1, 0); - $row = ($row ? $row->fetch_assoc() : array($id => "")); + $result = $driver->select($TABLE, array("*"), $where, array("*"), array(), 1, 0); + if ($result) { + $row = $result->fetch_assoc(); + } + if (!$row) { + $row = array($id => ""); + } } if ($row) { foreach ($row as $key => $val) {