【问题标题】:Error Number: 1096 Error Number: 1096 No tables错误号:1096 错误号:1096 没有表
【发布时间】:2014-04-04 05:49:15
【问题描述】:
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

没有使用表

选择 *

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

行号:330

请帮我解决这个问题

【问题讨论】:

    标签: codeigniter codeigniter-2 codeigniter-datamapper


    【解决方案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

    【讨论】:

    • 这些知识是随经验而来的吗? aka 只是潜入错误的错误命名足够长的时间,直到你知道?或者是否有一些文件可以解释 php magic 8 ball 错误消息的魔力?
    猜你喜欢
    • 2022-08-05
    • 2011-10-19
    • 2017-04-30
    • 1970-01-01
    • 2012-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-19
    相关资源
    最近更新 更多