首页 > 解决方案 > Codeigniter更新表替换mysql中的部分字符串

问题描述

我需要在 mysql 数据库中用逗号替换符号。我的查询是

UPDATE tbl_table set column = REPLACE(column,"#",",")

我需要在 codeignter 中执行相同的查询。所以我尝试了

function __construct(){
 $this->table = "tbl_table";
}
$this->db->$this->db->set('column',REPLACE('column','#',','),false);
$this->db->update($this->table);

这行不通。抛出这些错误

Message: Object of class Member could not be converted to string
Message: Trying to get property of non-object
Message: Call to a member function set() on null

我想要的是将“当天空打雷#这意味着下雨”更改为“当天空打雷时,它意味着下雨”。谢谢!

标签: mysqlcodeigniter

解决方案


推荐阅读