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 stru_replace和replace不工作_Php_Codeigniter - Fatal编程技术网

Php stru_replace和replace不工作

Php stru_replace和replace不工作,php,codeigniter,Php,Codeigniter,我想执行这个查询,但由于str_replace,它没有打印任何内容,我也用replace代替str_replace,但它对我不起作用。在哪里 $name=iFLY圣地亚哥儿童俱乐部 在数据库中-- 它就像iFLY圣地亚哥儿童俱乐部 请帮助任何人得到这个。 任何帮助都将不胜感激 提前谢谢 $rs = $this->db->select('*')

我想执行这个查询,但由于str_replace,它没有打印任何内容,我也用replace代替str_replace,但它对我不起作用。在哪里

$name=iFLY圣地亚哥儿童俱乐部

在数据库中-- 它就像iFLY圣地亚哥儿童俱乐部

请帮助任何人得到这个。 任何帮助都将不胜感激

提前谢谢

   $rs = $this->db->select('*')                                                                                                           
          ->from('table')
          ->where('table.status', 'Active')
          ->where('table.id', $id)
          ->where('table.title', str_replace('-',' ',$name))
          ->get()->result();
}

不要使用
str\u replace('-',''.$name)
try
str\u replace('-','.'''''.$name)

而不要使用
str\u replace('-','.$name)
try
str\u replace('-','''.''.''.'''.$name)
你可以这样做

$newname = str_replace("-","",$name); 

$rs = $this->db->select('*')                                                                                                           
          ->from('table')
          ->where('table.status', 'Active')
          ->where('table.id', $id)
          ->where('table.title', $newname)
          ->get()->result();
}
你可以这样做

$newname = str_replace("-","",$name); 

$rs = $this->db->select('*')                                                                                                           
          ->from('table')
          ->where('table.status', 'Active')
          ->where('table.id', $id)
          ->where('table.title', $newname)
          ->get()->result();
}

您的查询是完美的,但是您可以使用下面提到的
like
子句来代替
where

->where('table.title', str_replace('-',' ',$name))
替换为

->like('table.title', str_replace('-',' ',$name))
如果您像一样使用,则它将自动在查询中添加通配符(
%


如果它不起作用,请告诉我。

您的查询很完美,但是您可以使用下面提到的
类似的
子句,而不是
where

->where('table.title', str_replace('-',' ',$name))
替换为

->like('table.title', str_replace('-',' ',$name))
如果您像
一样使用
,则它将自动在查询中添加通配符(
%


如果不起作用,请告诉我。

尝试只打印str replace并检查它打印的内容。只打印str replace并检查它打印的内容prints@user6891871:很乐意帮忙you@user6891871字体很高兴帮助你