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