Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用codeigniter中的concat更新_Php_Codeigniter - Fatal编程技术网

Php 使用codeigniter中的concat更新

Php 使用codeigniter中的concat更新,php,codeigniter,Php,Codeigniter,我想在数据库中的现有数据中添加一个字符串,因此我使用普通的“concat” 我尝试使用codeigniter进行此操作失败 $daten['mycolumn1']='my new content'; $daten['mycolumn2']='my new content'; $daten['mycolumn3']="CONCAT('".date('U').";".$myvar.";mytext'),'mydbtable.mycolumn')"; $this->db->update('

我想在数据库中的现有数据中添加一个字符串,因此我使用普通的“concat”

我尝试使用codeigniter进行此操作失败

$daten['mycolumn1']='my new content';
$daten['mycolumn2']='my new content';
$daten['mycolumn3']="CONCAT('".date('U').";".$myvar.";mytext'),'mydbtable.mycolumn')";
$this->db->update('mytable', $data);
这也行不通

$daten['mycloumn3']=CONCAT("'".date('U').";".$myvar.";mytext','mydbtable.mycolumn'");
此语句将完整的“CONCAT('”.date('U')。;“$myvar.”mytext'),“mydbtable.mycolumn')”文本添加到“mycolumn”中


我做错了什么?

我无法在一个语句中找到解决方法,因此我将工作分为两个步骤

//For all other datas
$this->db->set($data);

//For the concat statement
$this->db->set('mycloumn', 'CONCAT(mycloumn,\''.date('U').';'.$myvar.';mytext#\')', FALSE);

我找不到一种方法在一份声明中完成这项工作,所以我将工作分为两步

//For all other datas
$this->db->set($data);

//For the concat statement
$this->db->set('mycloumn', 'CONCAT(mycloumn,\''.date('U').';'.$myvar.';mytext#\')', FALSE);

太多的“')”括号,应该是“
”CONCAT(“.date('U')”;“$myvar.”mytext“,'mydbtable.mycolumn')””
语法错误,意外的“U”(T_字符串),应为“')”@LbG这也只会用文本“CONCAT('1590484706;31;mytext','mydbtable.mycolumn'…”括号更新mycolumn的完整内容,应该是“
”CONCAT('date“('U').;“$myvar.”mytext','mydbtable.mycolumn')“
语法错误,意外的'U'(T_字符串),应为')”@LbG这也仅使用以下文本“CONCAT('1590484706;31;mytext','mydbtable.mycolumn'”更新mycolumn的完整内容