SQL语法错误-我的SQL

时间:2018-08-15 12:01:33

标签: mysql

ms_connect.query('INSERT INTO companies_codes VALUES (' + null + ',' + siteLoadWait + ',' + nextPageLoadWait + ',' + pagination + ',' + jsLoaded + ',' + pagesDefined + ',' + buttonLoading + ',' + singlePage + ',' + originAdding + ',' + addingSlashAfterOrigin + ',"' + nextPageButtonCode + '","' + jobsMetaCode + '","' + pagesMetaCode + '","' + pageJobsCode + '","' + jobsDetailsCode + '","' + buttonLoadingCode + '","' + undefinedPagesCode + '",' + refereceKey + ')', function(err, rows, fields) {
  if (err) {
    eventSameMess("database_error", err + " ");
  } else {
    eventSameMess("Database", "Data inserted Successfully into COMPANIES CODES table !");
  }
})

enter image description here

它显示以下错误:

  

错误:ER_PARSE_ERROR:您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以获取在'0,1,0,0,0,1,1,“”,“”,“”,“,”,“,”,“”附近使用正确的语法, “”,34)'在第1行

SQL查询:

INSERT INTO `companies_codes` (`id`, `site_load_wait`, `next_page_load_wait`, `pagination`, `js_loaded`, `pages_defined`, `button_loading`, `single_page`, `origin_adding`, `slash_in_origin`, `next_page_button_code`, `jobs_meta_code`, `pages_meta_code`, `page_jobs_data_code`, `jobs_details_code`, `button_loading_code`, `undefined_pages_code`, `comp_fk`) VALUES (NULL, '5000', '5000', '1', '1', '1', '1', '0', '0', '0', 'No', 'wait', 'found', 'here', 'mate', 'code', 'no code', '17');

1 个答案:

答案 0 :(得分:-2)

您需要以

格式在语句中定义列。

INSERT INTO tableName (columnName) VALUES (columnValue)

https://www.w3schools.com/nodejs/nodejs_mysql_insert.asp