Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.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更新或将iframe插入数据库?_Php_Mysql_Codeigniter_Iframe - Fatal编程技术网

Php 如何使用Codeigniter更新或将iframe插入数据库?

Php 如何使用Codeigniter更新或将iframe插入数据库?,php,mysql,codeigniter,iframe,Php,Mysql,Codeigniter,Iframe,我的前端有一个文本区,它接受一个iframe的GoogleMap代码。当我试图更新它时,查询失败。未将这些值插入到数据库中。我使用文本将iframe保存在db中。我在模型中使用的代码: function save(){ $data['cmpny_address'] = $this->input->post('cmpny_address'); $data['cmpny_map'] = $this->input->post('

我的前端有一个文本区,它接受一个iframe的GoogleMap代码。当我试图更新它时,查询失败。未将这些值插入到数据库中。我使用文本将iframe保存在db中。我在模型中使用的代码:

function save(){            
     $data['cmpny_address'] = $this->input->post('cmpny_address');   
     $data['cmpny_map'] = $this->input->post('cmpny_map'); 
     $this->db->where('id',1);
     $this->db->update('contact_us', $data); 
}
我尝试过用htmlspecialchars、strip_标记、$this->db->escape等清理输入。实际上,我已经尝试过相关SO问题的所有建议。但是没有运气。请有人提出解决问题的方法

编辑
造成了问题<代码>

,顺利通过。

无需编写任何
htmlspecialchars
strip\u标签
活动记录自动处理所有这些事情

使用
set
方法更新数据

function save(){            
     $this->db->set("cmpny_address", $this->input->post('cmpny_address'));
     $this->db->set("cmpny_map", $this->input->post('cmpny_map'));
     $this->db->where('id',1);
     $this->db->update('contact_us'); 
}

像这样创建数据数组

$data=array('cmpny_address'=>$this->input->post('cmpny_address'),'cmpny_map'=>$this->input->post('cmpny_map'));
$this->db->where('id',1);
$this->db->update('contact_us', $data);
更新

要将iframe发送到post,您必须设置

$config['global_xss_filtering'] = FALSE; 
在您的
config.php
文件中(代表OP发布)


这是一个服务器问题。支持团队说“modsecurity正在阻止它”。

这不是insert查询。您正在更新数据。@Saty:对不起,我将编辑此问题。感谢您将您的查询标记为已解决。要做到这一点,最好的方法是添加答案,您可以通过单击勾号符号自行接受答案。我们希望解决方案不被添加到问题中——它不属于那里。谢谢不工作。。我认为这是一个问题,而不是一个疑问。
$this->input->post('cmpny\u address')
$this->input->post('cmpny\u map')
?cmpny\u address=“sometext”的值是多少;和cmpny_map=只需尝试
html_实体解码($this->input->post('cmpny_map'))