今天用了CI框架对数据库进行insert一直不成功,不知道问题出在哪里了.
public function add()
{
$cn_name = $_POST['cn_name'];
$en_name = $_POST['en_name'];
$nt_code = $_POST['nt_code'];
$cr_code = $_POST['cr_code'];
$level = $_POST['level'];
$data=array();
$data['cr_code'] = $cr_code;
$data['cn_name'] = $cn_name;
$data['en_name'] = $en_name;
$data['nt_code'] = $nt_code;
$data['level'] = $level;
$res = $this->dict_model->addDict($data);
$redData = array(
"res" => $res,
'msg' => '添加成功'
);
echo json_encode($redData);
}
model层:
public function addDict($data) { $res = $this->db->insert('tbl_hscode_dict',$data); return $res; }
一直返回false