-1

これは私のテーブル定義です:

CREATE TABLE IF NOT EXISTS `sms_data_updated` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_sms_received` int(10) unsigned DEFAULT NULL,
  `sender_name` varchar(50) NOT NULL,
  `sender_number` char(14) NOT NULL,
  `key_word` varchar(20) NOT NULL,
  `message_content` varchar(160) NOT NULL,
  `date_received` datetime NOT NULL,
  `date_inserted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `categories` varchar(100) NOT NULL,
  `Division` varchar(30) NOT NULL,
  `location_name` varchar(80) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

また、次の INSERT ステートメントを使用する場合:

INSERT INTO sms_data_updated (id_sms_received, sender_name, sender_number, key_word, message_content, date_received, Division, location_name) 
VALUES (1,Shahriar Khondokar,+1726740333,,This is message content1. I need help1.,2012-10-16 10:11:09,Barisal,Borishal)

次のエラー メッセージが表示されます。

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 'Khondokar,+8801726740333,,This is message content1. I need help1.,2012-10-16 10:' at line 1

理由はありますか?

4

4 に答える 4

3

文字列値は一重引用符で囲む必要があります

VALUES(1,'Shahriar Khondokar','+172674033','This is message content1.',...)
于 2012-10-31T15:59:33.757 に答える
1

の後にカンマがぶら下がっているようですlocation_name

于 2012-10-31T15:58:09.210 に答える
1

Shahriar Khondokaのような文字列は、その周りに引用符が必要です。このような:

INSERT INTO sms_data_updated (id_sms_received, sender_name, sender_number, key_word, message_content, date_received, Division, location_name, Latitude, Longitude) 
VALUES (1,'Shahriar Khondokar',rest of columns...)
于 2012-10-31T15:58:55.297 に答える
1

クエリに挿入する行の量とは異なる数の値があります。これにより、問題が発生する可能性があります。

于 2012-10-31T16:03:00.850 に答える