1
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

It's showing the following error :

Error: ER_PARSE_ERROR: 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 '0,1,0,0,0,1,1,"","","","","","","",34)' at line 1

The SQL query :

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');
Nadeem Ahmad
  • 665
  • 3
  • 17
  • 40

1 Answers1

-2

You need to define your columns in your statement, in the format

INSERT INTO tableName (columnName) VALUES (columnValue):

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

Michael Hurley
  • 369
  • 2
  • 5
  • 15