CodeIgniter Forums
Issue with serialized arrays and active record - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Issue with serialized arrays and active record (/showthread.php?tid=50249)



Issue with serialized arrays and active record - El Forum - 03-20-2012

[eluser]jsuissa[/eluser]
When I pass a serialized array to a function in my model, the database update fails.

But when I serialize the array inside the data array of the model everything works.

This seesm very strange and I'm wondering if there is something else going on?
The issue only happens with serialized arrays?

This works:
Code:
$data = array(
$field => serialize($value)
);

$this->db->where($whereField, $whereValue);
$this->db->update($table, $data);

This doesn't work:

In controller: serialize($col);

Code:
$data = array(
$field => $value
);

$this->db->where($whereField, $whereValue);
$this->db->update($table, $data);