CodeIgniter Forums
Problem with Insert Data into Sql Server's Table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem with Insert Data into Sql Server's Table (/showthread.php?tid=68787)



Problem with Insert Data into Sql Server's Table - whalimkusuma - 08-25-2017

Hi Guys, need your help, i faced problem when inserting data into sql server's table. I've tried several methods namely :

here is my model syntax
Code:
$this->db->insert('tb_customer',$data)
where my controller function like this :
Code:
function save(){
$this->load->model('m_customer');        
$name            = $this->input->post('name');
$status            = $this->input->post('status');
$email            = $this->input->post('email');
$handphone        = $this->input->post('handphone');
$address        = $this->input->post('address');        

$data =  array (          'name'        =>  $name,
                         'status'            =>  $status,        
                         'email'        =>  $email,  
                         'handphone'        =>  $handphone,          
              'address'        =>  $address                                                                                           
                );
$this->m_customer->InsertCustomer('tb_customer',$data);
}
and
Code:
$this->db->set('name', $this->input->post('namepelanggan'));
$this->db->set('status', $this->input->post('status'));
$this->db->set('email', $this->input->post('email'));
$this->db->set('handphone', $this->input->post('handphone'));
$this->db->set('address', $this->input->post('address'));
$this->db->insert('tb_customer');

Please help me to fix this problem, thank you


RE: Problem with Insert Data into Sql Server's Table - dave friend - 08-25-2017

What exactly is the problem? Errors? Noting gets inserted? What?


RE: Problem with Insert Data into Sql Server's Table - whalimkusuma - 08-25-2017

(08-25-2017, 09:07 AM)dave friend Wrote: What exactly is the problem? Errors? Noting gets inserted? What?

there are no data inserted in table.
thanks


RE: Problem with Insert Data into Sql Server's Table - Wouter60 - 08-26-2017

Try this at the end of your model function:
PHP Code:
Echo $this->db->last_query();
Die(); 

It will show you the SQL query that is used to insert the data.