I am getting this error when ever i am uploading a file and storing details in the database using codeigniter
here is my controller
public function sugsn_up()
{
if ( $this->session->userdata('login_state') == FALSE )
$this->load->view('faculty/facultylog1_view');
else
{
$config['upload_path'] = './suggestion/';
$config['allowed_types'] = 'pdf|doc|docx|txt';
$config['max_size'] = '10000000';
$emp_id=$this->session->userdata('emp_id');
$this->load->library('upload', $config);
$tname='subject_master';
$res['sub']=$this->faculty_model->return_rec($tname);
$tname='course_master';
$res['crse']=$this->faculty_model->return_rec($tname);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('faculty/up_sugsn', $error,$res);
}
else
{
$data = array('upload_data' => $this->upload->data());
$path=base_url().'attendence/'.$data['upload_data']['file_name'];
$sdata=array('sug_id'=>NULL,
'emp_id'=>$emp_id,
'sug_name'=>$_POST['sugsn_name'],
'course_id'=> $_POST['cid'],
'sub_id'=> $_POST['sid'],
'link'=>$path
);
$this->faculty_model->sugsn_up($sdata);
$this->load->view('faculty/upload_success', $data);
}
}
}
and this is my model
public function sugsn_up($sdata)
{
$this->db->insert('suggestion _master',$sdata);
}
My suggestion _master table has 6 filds
Field Type Collation
sug_id bigint(20)
emp_id bigint(20)
sug_name text
course_id bigint(20)
sub_id bigint(20)
link text
and i am getting this error
A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '_master (sug_id
, emp_id
, sug_name
, course_id
, sub_id
, link
) VALUES (' at line 1
INSERT INTO suggestion
_master (sug_id
, emp_id
, sug_name
, course_id
, sub_id
, link
) VALUES (NULL, '1', 'test', '1', '1', 'file_link[soflo shows error when posting the exact link]')
Filename: C:\wamp\www\CMC\system\database\DB_driver.php
Line Number: 330
Can you find any thing wrong here?please help
Thanks and regards Dibyendu