mysql - 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
我想要的是将“当天空打雷#这意味着下雨”更改为“当天空打雷时,它意味着下雨”。谢谢!
解决方案
推荐阅读
- bash - 使用 bash 在远程服务器上执行多个命令
- javascript - 存储 dialogflow api 的代理 SessionsClient
- python - 选择 * 从一台机器插入到另一台机器
- api - 如何通过 GitHub API 查询 GitHub 组织的第三方访问权限?
- java - 整数输入的 JTextField 不为空
- android - Android:从其他活动跳回时自动打开屏幕键盘(软输入法)
- c# - 初始化后调用构造函数中的方法
- php - 为什么我的网页在不使用 www 时显示来自以前主机的页面?
- sql-server - SQL Server 2019:“Microsoft.ACE.OLEDB.16.0”提供程序未在本地计算机上注册。(系统.数据)
- sql - t-sql count 每个客户每月的订单数,包括零