I have a registration form with some fields which are not required. The user fills all the fields and then saves. The data is saved normally.
我有一个注册表格,其中包含一些不需要的字段。用户填写所有字段然后保存。数据正常保存。
However, if I update data and leave some fields blank, it would update the database record with empty values but CakePHP 1.3 does not update it in the database.
但是,如果我更新数据并将某些字段留空,则会使用空值更新数据库记录,但CakePHP 1.3不会在数据库中更新它。
1 个解决方案
#1
0
put a check for empty string and delete the empty keys from the array before saving to database
检查空字符串并在保存到数据库之前从数组中删除空键
#1
0
put a check for empty string and delete the empty keys from the array before saving to database
检查空字符串并在保存到数据库之前从数组中删除空键