CodeIgniter Forums
Append value to database field - 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: Append value to database field (/showthread.php?tid=5916)



Append value to database field - El Forum - 02-08-2008

[eluser]mvdg27[/eluser]
Hi,

I'm not sure if this is directly CI related, or has to do more with SQL queries in general .. anyway, I'm trying to append a value to a certain field, like so:
Code:
$where = 'id IN ('.$data['related'].')';                
$this->db->where($where);
$this->db->set('related', 'related,'.$this->db->insert_id());
$this->db->update('artists');

The correct rows are updated, but instead of appending, the current value get's overwritten with the string 'related'. Which makes sense, but I have no clue how to do this any other way ..

Anyone have an idea?

Thanks!


Append value to database field - El Forum - 02-08-2008

[eluser]Derek Allard[/eluser]
Could you give an example of the SQL you want to see output?