如何在sql和php中更新json数据
我正在开发一个表单,我必须以Json格式在sql中插入数据。 插入已完成。现在问题是更新 这是我在codeigniter中的更新模型:如何在sql和php中更新json数据,php,sql,json,codeigniter,Php,Sql,Json,Codeigniter,我正在开发一个表单,我必须以Json格式在sql中插入数据。 插入已完成。现在问题是更新 这是我在codeigniter中的更新模型: public function Update() { print("<pre>"); print_r($_POST); print_r($_REQUEST['Userid']);
public function Update()
{
print("<pre>");
print_r($_POST);
print_r($_REQUEST['Userid']);
print("</pre>");
$jsonData = json_encode($_POST);
$data2 = array(
'form_data' => $jsonData
);
$this->db->where($_REQUEST['Userid']);
$this->db->update('form',$data2);
return;
}
公共函数更新()
{
打印(“”);
$this->db->where($_REQUEST['Userid']);
打印(邮政美元);
$this->db->where($_REQUEST['Userid']);
打印($_请求['Userid']);
$this->db->where($_REQUEST['Userid']);
打印(“”);
$this->db->where($_REQUEST['Userid']);
$jsonData=json_编码($_POST);
$data2=数组(
“表单数据”=>$jsonData
);
$this->db->where($_请求['Userid']);
$this->db->update('form',$data2);
返回;
}
我的sql表有两个字段:(1)id(2)表单
在表单中,我以json格式存储所有表单数据。我在表单页面上获取了数据,但没有更新
$this->db->where('id',$_REQUEST['Userid']);`
应该是
where
子句中缺少列
参数