• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Insert Data into Sql Server's Table

#1
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
Reply

#2
What exactly is the problem? Errors? Noting gets inserted? What?
Reply

#3
(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
Reply

#4
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.