use reset()

master
Vitaliy Filippov 2013-04-17 12:26:31 +00:00
parent 7bb8bf1da2
commit 90e54ce3f6
1 changed files with 2 additions and 2 deletions

View File

@ -661,7 +661,7 @@ class DatabaseMysql implements Database
{ {
$table = $this->tableNames[$table]; $table = $this->tableNames[$table];
} }
$key = array_keys($rows[0]); $key = array_keys(reset($rows));
foreach ($rows as &$r) foreach ($rows as &$r)
{ {
$rs = array(); $rs = array();
@ -725,7 +725,7 @@ class DatabaseMysql implements Database
{ {
if (!is_array($rows)) if (!is_array($rows))
return false; return false;
if (!is_array(@$rows[0])) if (!is_array(reset($rows)))
$rows = array($rows); $rows = array($rows);
$sql = $this->insert_builder($table, $rows, empty($options['REPLACE']), !empty($options['REPLACE'])); $sql = $this->insert_builder($table, $rows, empty($options['REPLACE']), !empty($options['REPLACE']));
} }