Permalink
Browse files

Fixed a documentation error regarding Multiple insert (#737)

the current docs show that you can pass each row to be inserted as additional params to the query method, however when you try to do that it errors.  In looking up this error here: https://forum.nette.org/en/21412-nette-database-insert-multiple-rows-in-one-query I realized that the multiple rows need to be passed as an array in the second argument which solved the problem.
  • Loading branch information...
tempcke authored and dg committed Nov 27, 2018
1 parent 631aea8 commit 5c01974b92ba211b806cd21dd01b5ffbcde7f5dd
Showing with 14 additions and 10 deletions.
  1. +7 −5 cs/database-core.texy
  2. +7 −5 en/database-core.texy
@@ -126,11 +126,13 @@ Vícenásobný INSERT:

/--php
$database->query('INSERT INTO users', [
'name' => 'Jim',
'year' => 1978,
], [
'name' => 'Jack',
'year' => 1987,
[
'name' => 'Jim',
'year' => 1978,
], [
'name' => 'Jack',
'year' => 1987,
]
]);
// INSERT INTO users (`name`, `year`) VALUES ('Jim', 1978), ('Jack', 1987)
\--
@@ -125,11 +125,13 @@ Multiple insert:

/--php
$database->query('INSERT INTO users', [
'name' => 'Jim',
'year' => 1978,
], [
'name' => 'Jack',
'year' => 1987,
[
'name' => 'Jim',
'year' => 1978,
], [
'name' => 'Jack',
'year' => 1987,
]
]);
// INSERT INTO users (`name`, `year`) VALUES ('Jim', 1978), ('Jack', 1987)
\--

0 comments on commit 5c01974

Please sign in to comment.