[eluser]beatryder[/eluser]
[quote author="rkhalife" date="1193892216"]Hi,
I'm trying to set a value to NULL in the database through ActiveRecord.
Code:
$this->db->set('phone_2',NULL);
$this->db->where('id',$uid);
$this->db->update('user');
Unfortunately, the set function in the active record module is defined like this.
So it ends up setting the value to the empty string instead of NULL.
Code:
function set($key, $value = '')
I guess I could write the whole query myself, but I would rather use active record.
Is there a way around this?
Thanks,
-Raymond[/quote]
Sure
try this:
Code:
$this->db->set('phone_2','NULL'); //using the quotes usually works for me.
$this->db->where('id',$uid);
$this->db->update('user');