CodeIgniter Forums

Full Version: Problem with Insert Data into Sql Server's Table
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
What exactly is the problem? Errors? Noting gets inserted? What?
(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
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.