Fixes in fields for new mysql behaviour
This commit is contained in:
parent
94e3d63b0b
commit
29faed4b35
7 changed files with 27 additions and 6 deletions
|
|
@ -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).') ';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue