前端无法保存在函数插入$ data中

时间:2019-08-20 02:54:06

标签: codeigniter-3

我的数据库表是tb_permohonan,字段pk id_permohonan

  

这是我的函数,公共函数v_permohonan_member()

public function create_action() 
    {
        // $this->_rules();
        if ( $this->form_validation->run() == FALSE) {
             $this->v_permohonan_member();
        } else {
            $data = array(
            // 'id_permohonan'      => $this->input->post('id_permohonan',TRUE),
            'id_member'          => $this->input->post('id_member',TRUE),
            'jenis_pesanan'      => $this->input->post('jenis_pesanan',TRUE),
            'id_jenis_uttp'      => $this->input->post('id_jenis_uttp',TRUE),
            'kapasitas_maksimal' => $this->input->post('kapasitas_maksimal',TRUE),
            'merk'               => $this->input->post('merk',TRUE),
            'tipe'               => $this->input->post('tipe',TRUE),
            'nomor_seri'         => $this->input->post('nomor_seri',TRUE),
            'jumlah'             => $this->input->post('jumlah',TRUE),
            'ket_permohonan'     => $this->input->post('ket_permohonan',TRUE),
            'tanggal'            => date ("Y-m-d H:i:s"),
            );

            $this->Tb_permohonan_model->insert($data);
            // die($this->db->last_query()."sasa");
            // echo"<pre>"; print_r($data); die('sa');
            $this->session->set_flashdata('message', 'Data berhasil di simpan');
            redirect(site_url('frontend/v_permohonan_member'));
  • 这是我的模特:
class Tb_permohonan_model extends CI_Model
{

    public $table = 'tb_permohonan';
    public $id = 'id_permohonan';
    public $order = 'DESC';

    function __construct()
    {
        parent::__construct();
    }
   function insert($data)
    {
        $this->db->insert($this->table, $data);        
    }

如果已保存,请返回到表单页面。

0 个答案:

没有答案