Closed kuofp closed 6 years ago
// v1.4.5 did the trick, while v1.5.* raised an error // ErrorException Undefined index: col $db = new \Medoo\Medoo([ 'database_type' => 'mysql', 'database_name' => 'test', 'server' => 'test', 'username' => 'test', 'password' => 'test', 'charset' => 'utf8', ]); $db->query(' CREATE TEMPORARY TABLE `demo`( `id` INT NOT NULL, `col` INT NOT NULL, PRIMARY KEY(`id`) ) ')->fetchAll(); $arr = [ ['id' => 1], ['col' => 2], ]; $db->insert('demo', $arr);
The $arr should be
$arr
$arr = [ 'id' => 1, 'col' => 2 ];
or
$arr = [ [ 'id' => 1, 'col' => 2 ], [ 'id' => 2, 'col' => 1 ] ];