|
|
@@ -65,12 +65,12 @@ class CprMonitoringModel
|
|
|
RETURNING cpr_monitoring_id'
|
|
|
);
|
|
|
|
|
|
- $stmt->execute([
|
|
|
- 'cpr_id' => $cprId,
|
|
|
- 'preview' => $preview,
|
|
|
- 'description' => $description,
|
|
|
- 'link' => $link,
|
|
|
- ]);
|
|
|
+ $stmt->bindValue(':cpr_id', $cprId, \PDO::PARAM_INT);
|
|
|
+ $stmt->bindValue(':preview', $preview, \PDO::PARAM_BOOL);
|
|
|
+ $stmt->bindValue(':description', $description, \PDO::PARAM_STR);
|
|
|
+ $stmt->bindValue(':link', $link, \PDO::PARAM_STR);
|
|
|
+
|
|
|
+ $stmt->execute();
|
|
|
|
|
|
$id = (int)$stmt->fetchColumn();
|
|
|
|
|
|
@@ -107,7 +107,19 @@ class CprMonitoringModel
|
|
|
|
|
|
$sql = 'UPDATE "cpr_monitoring" SET ' . implode(', ', $fields) . ' WHERE cpr_monitoring_id = :id';
|
|
|
$stmt = $this->pdo->prepare($sql);
|
|
|
- $ok = $stmt->execute($params);
|
|
|
+
|
|
|
+ $stmt->bindValue(':id', $id, \PDO::PARAM_INT);
|
|
|
+ if (array_key_exists('preview', $params)) {
|
|
|
+ $stmt->bindValue(':preview', $params['preview'], \PDO::PARAM_BOOL);
|
|
|
+ }
|
|
|
+ if (array_key_exists('description', $params)) {
|
|
|
+ $stmt->bindValue(':description', $params['description'], \PDO::PARAM_STR);
|
|
|
+ }
|
|
|
+ if (array_key_exists('link', $params)) {
|
|
|
+ $stmt->bindValue(':link', $params['link'], \PDO::PARAM_STR);
|
|
|
+ }
|
|
|
+
|
|
|
+ $ok = $stmt->execute();
|
|
|
if (!$ok) {
|
|
|
return null;
|
|
|
}
|