doutao1939 2013-09-09 20:26
浏览 39
已采纳

错误号码:codeigniter中的1064

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

  • 写回答

1条回答 默认 最新

  • douxiezha9319 2013-09-09 20:28
    关注
    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥15 关于logstash转发日志时发生的部分内容丢失问题
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题