MongoDB: Fix insert form with empty table
This commit is contained in:
parent
f301fc2dcd
commit
4bab88a1a0
|
@ -100,8 +100,13 @@ if ($_POST["save"]) {
|
||||||
if (!support("table") && !$fields) {
|
if (!support("table") && !$fields) {
|
||||||
$id = ($jush == "mongo" ? "_id" : "itemName()"); // simpledb
|
$id = ($jush == "mongo" ? "_id" : "itemName()"); // simpledb
|
||||||
if (!$where) { // insert
|
if (!$where) { // insert
|
||||||
$row = $driver->select($TABLE, array("*"), $where, array("*"), array(), 1, 0);
|
$result = $driver->select($TABLE, array("*"), $where, array("*"), array(), 1, 0);
|
||||||
$row = ($row ? $row->fetch_assoc() : array($id => ""));
|
if ($result) {
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
}
|
||||||
|
if (!$row) {
|
||||||
|
$row = array($id => "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($row) {
|
if ($row) {
|
||||||
foreach ($row as $key => $val) {
|
foreach ($row as $key => $val) {
|
||||||
|
|
Loading…
Reference in a new issue