[eluser]blasto333[/eluser]
I am having a really really odd problem using the $this->db->set function. I am using the latest version of codeigniter. Here is the isolated code.
Code:
function save($item_data,$item_id=false)
{
$this->db->set($item_data);
if (!$item_id or !$this->exists($item_id))
{
return $this->db->insert('items');
}
$this->db->where('item_id', $item_id);
return $this->db->update('items');
}
var_dump of
$this->ar_set in the CI_DB_Active_Record_Class
var_dump occurs JUST BEFORE
Code:
$sql = $this->_insert($this->_protect_identifiers($this->dbprefix.$table), array_keys($this->ar_set), array_values($this->ar_set));)
array(6) {
["`name`"]=>
string(41) "'Duracell AA Alkaline batteries - 4 pack'"
["`category`"]=>
string(13) "'Electronics'"
["`item_number`"]=>
string(14) "'041333015330'"
["`buy_price`"]=>
string(2) "''"
["`unit_price`"]=>
string(6) "'4.95'"
["`tax_percent`"]=>
string(3) "'8'"
}
Code:
function save($item_data,$item_id=false)
{
if (!$item_id or !$this->exists($item_id))
{
return $this->db->insert('items',$item_data);
}
$this->db->where('item_id', $item_id);
return $this->db->update('items',$item_data);
}
var_dump of
$this->ar_set in the CI_DB_Active_Record_Class
var_dump occurs JUST BEFORE
Code:
$sql = $this->_insert($this->_protect_identifiers($this->dbprefix.$table), array_keys($this->ar_set), array_values($this->ar_set));)
array(11) {
["`name`"]=>
string(41) "'Duracell AA Alkaline batteries - 4 pack'"
["`description`"]=>
string(41) "'Duracell AA Alkaline batteries - 4 pack'"
["`category`"]=>
string(13) "'Electronics'"
["`item_number`"]=>
string(14) "'041333015330'"
["`buy_price`"]=>
string(2) "''"
["`unit_price`"]=>
string(6) "'4.95'"
["`tax_percent`"]=>
string(3) "'8'"
["`sale_markdown_percent`"]=>
string(2) "''"
["`employee_markdown_percent`"]=>
string(2) "''"
["`quantity`"]=>
string(2) "''"
["`reorder_level`"]=>
string(2) "''"
}
THIS IS THE EXPECTED OUTPUT!! I AM NOT SURE WHAT IS HAPPENING THAT IS CAUSING FIELDS TO JUST DISAPPEAR
FROM $this->ar_set.