Don't save undefined atributes.
This commit is contained in:
parent
d04cd18c9a
commit
5679bbf2c5
@ -243,9 +243,11 @@ class ModelMySQL {
|
|||||||
$atts = $this->getVars();
|
$atts = $this->getVars();
|
||||||
|
|
||||||
foreach ($atts as $key => $value) {
|
foreach ($atts as $key => $value) {
|
||||||
|
if (isset($value)) {
|
||||||
$into[] = "`$key`";
|
$into[] = "`$key`";
|
||||||
$values[] = "'".$db->real_escape_string($value)."'";
|
$values[] = "'".$db->real_escape_string($value)."'";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$table = static::table();
|
$table = static::table();
|
||||||
$sql = "INSERT INTO $table (".join(', ', $into).") VALUES (".join(', ', $values).")";
|
$sql = "INSERT INTO $table (".join(', ', $into).") VALUES (".join(', ', $values).")";
|
||||||
|
Loading…
Reference in New Issue
Block a user