Skip to content

Commit

Permalink
Fixed a documentation error regarding Multiple insert (#737)
Browse files Browse the repository at this point in the history
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 Dec 27, 2021
1 parent e3faf3e commit f1ffc67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions doc/cs/database-core.texy
Expand Up @@ -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)
\--
Expand Down
12 changes: 7 additions & 5 deletions doc/en/database-core.texy
Expand Up @@ -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)
\--
Expand Down

0 comments on commit f1ffc67

Please sign in to comment.