diff --git a/dblayer.php b/dblayer.php index db9765a..d830d1f 100644 --- a/dblayer.php +++ b/dblayer.php @@ -173,7 +173,8 @@ class dblayer extends PDO return $res; } - /** Update the key tuple with the provided datas */ + /** Update the key tuple with the provided datas + Return the number of rows modified */ function update ($updatekey, $datas) { if ($this->db === null) @@ -186,6 +187,8 @@ class dblayer extends PDO if (array_key_exists ($key, $datas)) $datasOK[$key] = $datas[$key]; } + if (count ($datasOK) === 0) + throw new Exception (_("Don't receive any field to display"), 501); $req = "UPDATE `".$this->table."` SET "; $i = 0; @@ -218,6 +221,7 @@ class dblayer extends PDO } $st->execute (); + return $st->rowCount(); } /** Delete a tuple identified by its primary key