From dea292339aef93190728ac5bb4ee88676897f871 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 31 Jul 2014 12:54:04 +0000 Subject: [PATCH] dblayer : don't check the non provided field in update git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1623 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayer.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dblayer.php b/dblayer.php index 82a4726..0d0d040 100644 --- a/dblayer.php +++ b/dblayer.php @@ -457,9 +457,10 @@ class dblayer extends PDO // Check for missing parameters foreach ($this->fields as $key=>$params) { - // Verify the fields, if $verify is defined, before doing insertion - if (array_key_exists ($key, $datas)) - $datasOK[$key] = $datas[$key]; + // Don't save a none provided field. The old value will be use in database + if (!array_key_exists ($key, $datas)) + continue; + // Check for type inconsistencies if the value is provided if ($datas[$key] !== "" && $params[0] === "integer") { @@ -504,6 +505,8 @@ class dblayer extends PDO { // Nothing to do if the value is empty : just save it } + + $datasOK[$key] = $datas[$key]; } if (count ($datasOK) === 0)