错误号码:1096错误号码:1096没有表格

时间:2014-04-04 05:49:15

标签: codeigniter codeigniter-2 codeigniter-datamapper

class model_trans_gc  extends CI_Model{
    function trans_gc_add()
    {
        $add=array(
            'trans_gc_date' => $this->input->post('trans_gc_date'),
             'trans_gc_no' => $this->input->post('trans_gc_no'),
             'trans_gc_consname' => $this->input->post('trans_gc_consname'),
             'trans_gc_consbank' => $this->input->post('trans_gc_consbank'),
             'trans_gc_consname_add' => $this->input->post('trans_gc_consname_add'),
             'trans_gc_consbank_add' => $this->input->post('trans_gc_consbank_add'),
             'trans_gc_comp' => $this->input->post('trans_gc_comp'),
             'trans_gc_pol' => $this->input->post('trans_gc_pol'),
             'trans_gc_amt' => $this->input->post('trans_gc_amt'),
             'trans_gc_insdate' => $this->input->post('trans_gc_insdate'),
             'trans_gc_risk' => $this->input->post('trans_gc_risk'),
             'trans_gc_from' => $this->input->post('trans_gc_from'),
             'trans_gc_to' => $this->input->post('trans_gc_to'), 
            'trans_gc_packno' => $this->input->post('trans_gc_packno'),
             'trans_gc_packdesc' => $this->input->post('trans_gc_packdesc'),
             'trans_gc_actweight' => $this->input->post('trans_gc_actweight'),
             'trans_gc_charweight' => $this->input->post('trans_gc_charweight'),
               'trans_gc_method_pack' => $this->input->post('trans_gc_method_pack'), 
               'trans_gc_frt' => $this->input->post('trans_gc_frt'), 
               'trans_gc_hamali' => $this->input->post('trans_gc_hamali'), 
               'trans_gc_sr' => $this->input->post('trans_gc_sr'), 
               'trans_gc_aoc' => $this->input->post('trans_gc_aoc'), 
               'trans_gc_doorcln' => $this->input->post('trans_gc_doorcln'), 
               'trans_gc_doordel' => $this->input->post('trans_gc_doordel'), 
             'trans_gc_riskch' => $this->input->post('trans_gc_riskch'), 
             'trans_gc_dem' => $this->input->post('trans_gc_dem'), 
             'trans_gc_gc' => $this->input->post('trans_gc_gc'), 
             'trans_gc_total' => $this->input->post('trans_gc_total'), 
             'trans_gc_paymode' => $this->input->post('trans_gc_paymode'), 
             'trans_gc_crno' => $this->input->post('trans_gc_crno'), 
            'status' => '1'
        );
        $this->db->insert('trans_gc_add',$add);
        $query=$this->db->get();
         return $query->result();

    }
}

发生数据库错误

错误号码:1096

没有使用表格

SELECT *

文件名:C:\ xampp \ htdocs \ speed \ system \ database \ DB_driver.php

行号:330

请帮我解决这个问题

1 个答案:

答案 0 :(得分:1)

删除这些行:

 $query=$this->db->get();
 return $query->result();

您正在插入数据库,然后使用get()

运行空查询

如果要在成功插入数据时返回,请执行以下操作:

return $this->db->insert('trans_gc_add',$add);

如果要返回插入的数据:

return $add;

http://ellislab.com/codeigniter/user-guide/database/active_record.html#insert