Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8669189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:24:40+00:00 2026-06-12T18:24:40+00:00

i got an error like this You have an error in your SQL syntax;

  • 0

i got an error like this

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 ‘Satuan, `Satuan`) VALUES (‘KMJ001’, ‘KKMJ005’, ‘asdf asdf’, ‘123123’, ‘kg’)’ at line 1

INSERT INTO `ms_material_jasa` (`Kode_Material_Jasa`, `Kode_Kategori_Material_Jasa`, `Nama_Jenis_Material_Jasa`, `Harga` Satuan, `Satuan`) VALUES (‘KMJ001’, ‘KKMJ005’, ‘asdf asdf’, ‘123123’, ‘kg’)

it refers to my active record model

function create($kmj,$kkmj,$njmj,$hs,$s)
{
    $data=array('Kode_Material_Jasa' => $kmj, 'Kode_Kategori_Material_Jasa' => $kkmj, 'Nama_Jenis_Material_Jasa' => $njmj, 'Harga Satuan' => $hs, 'Satuan' => $s);
    $this->db->insert('ms_material_jasa',$data);

}  

here is my controller

 function tambah()
{
   $data['kmj'] = $this->input->post('kmj');
   $data['kkmj'] = $this->input->post('kkmj');
   $data['njmj'] = $this->input->post('njmj');
   $data['hs'] = $this->input->post('hs');
   $data['s'] = $this->input->post('s');


   $data['title'] = 'QB Tambah Material / Jasa';
   $data['pesan'] = $data['kmj'].' berhasil ditambahkan ! ';


    $this->form_validation->set_rules('kmj','Kode Material / Jasa','trim|required|min_length[2]|max_length[20]|xss_clean');
    $this->form_validation->set_rules('kkmj','Kode Kategori Material / Jasa','trim|required|min_length[2]|max_length[20]|xss_clean');
    $this->form_validation->set_rules('njmj','Nama Jenis Material / Jasa','trim|required|min_length[2]|max_length[20]|xss_clean');
    $this->form_validation->set_rules('hs','Harga Satuan','trim|required|min_length[2]|numeric|max_length[20]|xss_clean');
    $this->form_validation->set_rules('s','Satuan','xss_clean');

    if($this->form_validation->run() == false)
    {
        $lastval = $this->m_admin->getlastval('KMJ','ms_material_jasa','kode_material_jasa');
        $data['nextval'] = $this->m_admin->gencode('KMJ',3,$lastval); 


        $this->load->view('head',$data);
        $this->load->view('content/add_material_jasa',$data);
    }
    else
    {

        $this->m_materialjasa->create($data['kmj'],$data['kkmj'],$data['njmj'],$data['hs'],$data['s']);
        $data['kirim'] = $this->m_materialjasa->read();
        $this->load->view('head',$data);
        $this->load->view('v/vkategorimaterial',$data);


    }

}  

looks like the following query

INSERT INTO `ms_material_jasa` (`Kode_Material_Jasa`, `Kode_Kategori_Material_Jasa`, `Nama_Jenis_Material_Jasa`, `Harga` Satuan, `Satuan`) VALUES (‘KMJ001’, ‘KKMJ005’, ‘asdf asdf’, ‘123123’, ‘kg’)

is correct, here is the ms_material_jasa table. it looks like the entry don’t break the data type.length on database. i don’t know what went wrong, how do i resolve this ?
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:24:42+00:00Added an answer on June 12, 2026 at 6:24 pm

    Your quote is in the wrong place on ‘Harga Satuan’ in the fields list. The error actually says that.
    Yours:

    INSERT INTO `ms_material_jasa` (`Kode_Material_Jasa`, `Kode_Kategori_Material_Jasa`, `Nama_Jenis_Material_Jasa`, `Harga` Satuan, `Satuan`) VALUES (‘KMJ001’, ‘KKMJ005’, ‘asdf asdf’, ‘123123’, ‘kg’)
    

    Correct:

    INSERT INTO `ms_material_jasa` (`Kode_Material_Jasa`, `Kode_Kategori_Material_Jasa`, `Nama_Jenis_Material_Jasa`, `Harga_Satuan`, `Satuan`) VALUES (‘KMJ001’, ‘KKMJ005’, ‘asdf asdf’, ‘123123’, ‘kg’)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two databases, one MySQL 5, one SQL Server 2000. I've got the
I've got a simple SQL query that keeps throwing an SQL syntax error. It
I 've got the same problem like in this question: SSL Error on Port
Hi i ve got two tables like this: mysql> describe tb_data_iae; +--------------------+--------------+------+-----+---------+----------------+ | Field
I have some code in Codeigniter that looks like this: $this->db->select('email_account_id'); $this->db->where('TRIM(LOWER(email_account_incoming_username))',trim(strtolower($email_address))); $query =
GOT error for the following query in MYSQL(version5.1) SELECT year,month,sum(fact_1),sum(fact_2),sum(fact_3),sum(fact_4) from( select year,month,fact_1,fact_2,0 as
I got error when I write this code @Html.X().ResourceManager() in view error message :
I have run an ssis package and got error in one of the tasks(the
I updated the Npgsql driver to the last version (2.0.5) and got error in
Up until today, this is the query that got everything I needed to know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.