Skip to content

Commit

Permalink
Db prepared statements insert + select (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudBAYOL committed Oct 4, 2021
1 parent e1358d8 commit d0dde26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/devapi/database/dbupdate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Let's see an example with an insert statement:
]
);
// => INSERT INTO `glpi_my_table` (`field`, `other`) VALUES (?, ?)
$insert_stmt = $DB->prepare($insert_query);
$stmt = $DB->prepare($insert_query);
foreach ($data as $row) {
$stmt->bind_params(
Expand Down Expand Up @@ -131,5 +131,7 @@ Preparing a `SELECT` query is a bit different:
'something' => new Queryparam(),
'foo' => 'bar'
]);
$query = $it->getSql();
// => SELECT FROM `my_table` WHERE `something` = ? AND `foo` = 'bar'
$stmt = $DB->prepare($query);
// [...]

0 comments on commit d0dde26

Please sign in to comment.