Fixes in fields for new mysql behaviour

This commit is contained in:
Antonio de la Rosa 2019-06-18 23:32:58 +02:00
parent 94e3d63b0b
commit 29faed4b35
7 changed files with 27 additions and 6 deletions

View file

@ -680,8 +680,12 @@ class Webmodel {
{
//Foreach for create the query that comes from the $post array
foreach($fields as $key => $field)
$components=$this->components;
unset($components[$this->idmodel]);
foreach($components as $key => $field)
{
$quot_open=$this->components[$key]->quot_open;
@ -699,12 +703,23 @@ class Webmodel {
$fields[$key]='NULL';
}
}
$arr_fields[]=$quot_open.$fields[$key].$quot_close;
if(!isset($fields[$key]))
{
$arr_fields[]=$quot_open.$this->components[$key]->default_value.$quot_close;
}
else
{
$arr_fields[]=$quot_open.$fields[$key].$quot_close;
}
}
return 'insert into '.$this->name.' (`'.implode("`, `", array_keys($fields)).'`) VALUES ('.implode(", ",$arr_fields).') ';
return 'insert into '.$this->name.' (`'.implode("`, `", array_keys($components)).'`) VALUES ('.implode(", ",$arr_fields).') ';
}