Número de error: 1064 en codeigniter

I am getting this error when ever i am uploading a file and storing details in the database using codeigniter

aquí está mi controlador

    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);
    }
    }
}

y este es mi modelo

    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

y recibo este error

Ocurrió Un Error en la Base de Datos

Número de error: 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

Insertar en 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

Número de línea: 330

Can you find any thing wrong here?please help

Thanks and regards Dibyendu

preguntado el 09 de septiembre de 13 a las 21:09

1 Respuestas

INSERT INTO `suggestion _master`..

Add backticks for table and column names if they contain empty spaces,but empty spaces in table names are not OK.

Respondido el 09 de Septiembre de 13 a las 21:09

thank you so much i didn't notice the empty space, its working now. - Dibyendu Singha Roy

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.