I want to concat a single field with a variable in Mysql using codeigniter.
$this->db->set('my_field', 'my_field'.'My_variable', FALSE);
$this->db->where('my_other_field', 'test');
$this->db->update('my_table');
You cannot use . as concatenation for mysql you need to use CONCAT
function
$this->db->set('my_field', "CONCAT(my_field,' ','".$your_variable."')", FALSE);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.