【发布时间】:2011-08-20 23:54:28
【问题描述】:
我首先将数据添加到表events,字段exceptions 像这样
function events_exceptions($rec_id, $evt_id)
{
//$evt_id = 1;
$this->db->where('record_id', $rec_id);
$this->db->update('events', array('exceptions' => $evt_id));
}
这会给我
exceptions
1
如果我用$evt_id = 2 再次运行它,我会得到
exceptions
2
等等。
我想实际将新数据附加到该字段而不是更新,所以我会(注意逗号)
exceptions
1,2,3 //etc
我认为这可以通过调用 DB、读取行/字段的内容并通过 PHP 连接来完成 - 然后更新记录。但我想避免这样的开销。
有没有办法通过 MySQL CONCAT 做到这一点?
感谢您的帮助。
【问题讨论】:
标签: php mysql concatenation concat