Skip to content

Commit f889dbc

Browse files
committed
Fix insert() for empty values array
1 parent be8b612 commit f889dbc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MysqliDb.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,9 @@ protected function _buildInsertQuery($tableData)
13311331
$isInsert = preg_match('/^[INSERT|REPLACE]/', $this->_query);
13321332
$dataColumns = array_keys($tableData);
13331333
if ($isInsert) {
1334-
$this->_query .= ' (`' . implode($dataColumns, '`, `') . '`) VALUES (';
1334+
if (isset ($dataColumns[0]))
1335+
$this->_query .= ' (`' . implode($dataColumns, '`, `') . '`) ';
1336+
$this->_query .= ' VALUES (';
13351337
} else {
13361338
$this->_query .= " SET ";
13371339
}

0 commit comments

Comments
 (0)