From a7cb44a04be226b40ce9b5a9fc7aca8eb9326e0b Mon Sep 17 00:00:00 2001 From: kj Date: Wed, 22 Jul 2020 10:25:51 -0400 Subject: [PATCH] Don't save undefined atributes. --- src/Libs/ModelMySQL.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Libs/ModelMySQL.php b/src/Libs/ModelMySQL.php index 4f1f8d7..3b50f3e 100644 --- a/src/Libs/ModelMySQL.php +++ b/src/Libs/ModelMySQL.php @@ -223,8 +223,10 @@ class ModelMySQL { $atts = $this->getVars(); foreach ($atts as $key => $value) { - $value = static::db()->real_escape_string($value); - $set[]="$key='$value'"; + if (isset($value)) { + $value = static::db()->real_escape_string($value); + $set[]="$key='$value'"; + } } $table = static::table();