Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无明显原因获取错误2064_Javascript_Mysql_Node.js_Json - Fatal编程技术网

Javascript 无明显原因获取错误2064

Javascript 无明显原因获取错误2064,javascript,mysql,node.js,json,Javascript,Mysql,Node.js,Json,好的,我正在从nodejs上传值到一个mysql表,我得到了错误1064,好像它的格式很差,但我找不到问题。以下是查询: `"INSERT INTO product_specifics (product_spec_url, product_name, product_price, product_date, product_water_resistan, product_ip_rating, product_battery_capacity, product_fast_charging, pr

好的,我正在从nodejs上传值到一个mysql表,我得到了错误1064,好像它的格式很差,但我找不到问题。以下是查询:

`"INSERT INTO product_specifics (product_spec_url, product_name, product_price, product_date, product_water_resistan,
 product_ip_rating, product_battery_capacity, product_fast_charging, product_brand, product_image_url,
 product_screen_resolution, product_screen_width, product_pixel_per_inch, product_processor,roduct_processor_name,
 product_ram, product_storage, product_storage_expandable, product_rear_camera_resolution,
 product_rear_camera_number,product_front_camera_resolution, product_front_camera_number, 
product_operating_system_name, product_operating_system_version, product_wifi_standards,product_bluetooth_avaible,
 product_bluetooth_version, product_nfc_avaible, product_audio_jack, product_face_unlock, product_safe_face_unlock)
 VALUES
 ('https://gadgets.ndtv.com/acer-liquid-z6-plus-3730','Acer Liquid Z6 Plus','null','2016-08-15','0','null','4080',
'null','Acer','https://drop.ndtv.com/TECH/product_database/images/831201661028PM_635_acer_liquid_z6_plus.jpeg?downsize=*:180&output-quality=80',
'1920x1080 pixels','5.5','0','1.3GHz octa-core','MediaTek MT6753','3','32','1','13','1','5','1','Android','6',
'802.11 b/g/n','1','null','0','3.5mm','0','0');"`
这是密码

const mysql      = require('mysql');

var con = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : '',
  database : 'myDB'
});

con.connect(function(err) {
  if (err) throw err;
  console.log("You are now connected with mysql database...");
});  

const uploader = function(potusParse) {
  var lenght = potusParse.length;
  for (let i = 0; i < lenght; i++) {
    var object = potusParse[i];
    con.query("big buoy above", function (err, result) {
      if (err) throw err;
      console.log("1 record inserted");
    });
  }
}

请随意留下任何关于改进我的代码的建议;提前感谢

我认为
产品处理器名称
不是表中的有效列

(不清楚这是打字错误还是复制/粘贴错误,或者这是否是代码中的实际内容。)

还要注意,在单引号中,
'null'
是字符串文字;如果我们想指定一个空值,我们使用
null
关键字,而不是用单引号括起来

(还有,为什么拼写
可用
?通常,使用实际的英语单词更容易,而不是使用特殊的缩写。)


重新格式化的SQL语句:

INSERT INTO product_specifics
( product_spec_url
, product_name
, product_price
, product_date
, product_water_resistan
, product_ip_rating
, product_battery_capacity
, product_fast_charging
, product_brand
, product_image_url
, product_screen_resolution
, product_screen_width
, product_pixel_per_inch
, product_processor
, roduct_processor_name                        /* invalid column name ? */
, product_ram
, product_storage
, product_storage_expandable
, product_rear_camera_resolution
, product_rear_camera_number
, product_front_camera_resolution
, product_front_camera_number
, product_operating_system_name
, product_operating_system_version
, product_wifi_standards
, product_bluetooth_avaible
, product_bluetooth_version
, product_nfc_avaible
, product_audio_jack
, product_face_unlock
, product_safe_face_unlock
)
VALUES
( 'https://gadgets.ndtv.com/acer-liquid-z6-plus-3730'
, 'Acer Liquid Z6 Plus'
, 'null'                                       /* string literal, not NULL value */
, '2016-08-15'
, '0'
, 'null'                                       /* string literal, not NULL value */
, '4080'
, 'null'
, 'Acer'
, 'https://drop.ndtv.com/TECH/product_database/images/831201661028PM_635_acer_liquid_z6_plus.jpeg?downsize=*:180&output-quality=80'
, '1920x1080 pixels'
, '5.5'
, '0'
, '1.3GHz octa-core'
, 'MediaTek MT6753'
, '3'
, '32'
, '1'
, '13'
, '1'
, '5'
, '1'
, 'Android'
, '6'
, '802.11 b/g/n'
, '1'
, 'null'
, '0'
, '3.5mm'
, '0'
, '0'
)

好的,问题是我不必在`

之前和之后加上“是的,产品的事情是错误的,但我仍然会得到错误通常MySQL 1064错误消息包括一个“使用近”“然后是SQL文本中MySQL标记问题的点;这并不总是真正的问题所在,但它确实是一条重要的线索。考虑编辑问题以包含完整的错误消息。
`You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"INSERT INTO product_specifics (product_spec_url, product_name, product_price, p' at line 1`,
INSERT INTO product_specifics
( product_spec_url
, product_name
, product_price
, product_date
, product_water_resistan
, product_ip_rating
, product_battery_capacity
, product_fast_charging
, product_brand
, product_image_url
, product_screen_resolution
, product_screen_width
, product_pixel_per_inch
, product_processor
, roduct_processor_name                        /* invalid column name ? */
, product_ram
, product_storage
, product_storage_expandable
, product_rear_camera_resolution
, product_rear_camera_number
, product_front_camera_resolution
, product_front_camera_number
, product_operating_system_name
, product_operating_system_version
, product_wifi_standards
, product_bluetooth_avaible
, product_bluetooth_version
, product_nfc_avaible
, product_audio_jack
, product_face_unlock
, product_safe_face_unlock
)
VALUES
( 'https://gadgets.ndtv.com/acer-liquid-z6-plus-3730'
, 'Acer Liquid Z6 Plus'
, 'null'                                       /* string literal, not NULL value */
, '2016-08-15'
, '0'
, 'null'                                       /* string literal, not NULL value */
, '4080'
, 'null'
, 'Acer'
, 'https://drop.ndtv.com/TECH/product_database/images/831201661028PM_635_acer_liquid_z6_plus.jpeg?downsize=*:180&output-quality=80'
, '1920x1080 pixels'
, '5.5'
, '0'
, '1.3GHz octa-core'
, 'MediaTek MT6753'
, '3'
, '32'
, '1'
, '13'
, '1'
, '5'
, '1'
, 'Android'
, '6'
, '802.11 b/g/n'
, '1'
, 'null'
, '0'
, '3.5mm'
, '0'
, '0'
)