Php SQL插入出错

Php SQL插入出错,php,mysql,sql,wordpress,Php,Mysql,Sql,Wordpress,我试图对一个表运行insert,但我的语句不断出错,因为我在语句中使用了像to和and这样的词 如何将这些段落输入数据库 INSERT INTO messages (message_title, message_content, from_user, to_user, date, type, delivered, deleted) VALUES('Dont forget to configure your profile!', 'Welc

我试图对一个表运行insert,但我的语句不断出错,因为我在语句中使用了像to和and这样的词

如何将这些段落输入数据库

INSERT INTO messages (message_title, message_content, from_user,
                      to_user, date, type, delivered, deleted)
VALUES('Dont forget to configure your profile!',
       'Welcome to the Club. The FIRST step to getting started is to set up your
        personal profile and your personal goals. You cant improve what you dont
        measure! Click on the following link and get your profile set up today.
        Set up my profile NOW. If you have any questions please be sure to contact
        our support team at info@support.com.',
       '1', '1', '2014-09-26', '0', '0', '0')

我在这里对你的模式做了一些假设,但我即将出发,所以我想发布这篇文章,看看它是否有帮助:

这里我假设您的已删除列和已传递列都是位字段,当尝试使用“1”而不是“1”插入位字段时,语句会出错。正如您通过fiddle所看到的,经过(稍微)修改的insert语句确实有效。希望这能帮到你


另外,我假设其他'1'是int列,插入这些列时也不需要引号。

有什么错误?在字符串值中包含“to”和“and”不会打断insert语句,请提供您的错误消息表的结构是什么?
message\u content
的数据类型应为
TEXT
VARCHAR(1024)
不是保留字问题。。。我很担心日期/类型,但他们没问题。
create table messages (message_title varchar(500), message_content varchar(8000), from_user int, to_user int, date datetime, type int, delivered bit, deleted bit);

INSERT INTO messages (message_title, message_content, from_user, to_user, date, type, delivered, deleted) 
VALUES(
'Dont forget to configure your profile!', 
'Welcome to the Club. The FIRST step to getting started is to set up your personal profile and your personal goals. You cant improve what you dont measure! 
    Click on the following link and get your profile set up today. Set up my profile NOW
    If you have any questions please be sure to contact our support team at info@support.com.',
'1', 
'1', 
'2014-09-26', 
'0', 
0, 
0);

select * from messages