-1
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();

    }
}

Database Error Occurred

Error Number: 1096

No tables used

SELECT *

Filename: C:\xampp\htdocs\speed\system\database\DB_driver.php

Line Number: 330

please help me to resolve this problem

user3431713
  • 9
  • 1
  • 3

1 Answers1

3

Remove those lines:

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

You are inserting into the db, then you are running empty query with get()

If you want to return if the data was successfully inserted or not, then do this:

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

If you want to return the inserted data:

return $add;

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

CMPS
  • 7,733
  • 4
  • 28
  • 53
  • Does this knowledge just come with experience? aka just diving through the bad error naming long enough until you know? or is there some documents somewhere that explains the magic of php magic 8 ball error messages? – Urasquirrel Jun 05 '20 at 15:35