我正在使用 codeigniter 并使用以下代码添加 json 数据。
function back_up($id){
$this->db->select("startTime, endTime, day, contact_id, people_id, type, editName, editTime, editId, comment, uuid, motif");
$this->db->where('id',$id);
$data = $this->db->get('table')->row_array();
$json_data = json_encode($data);
$udata = array('editHistory' => $json_data);
$this->db->where('id',$id);
$this->db->update('table', $udata);
}
当我运行此函数时,它仅显示编码的 json 数据,但数据库未更新。 如何将json添加到数据库
最佳答案
看看 phpMyAdmin editHistory 列是文本,而不是数字。
关于php将json数据添加到mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25893538/