check the manual that corresponds to your MySQL server version for the right syntax报错另一种解决方法
Error: INSERT INTO post(title, author, content, dateline)values(‘标题’, ‘作者’, ‘文章内容’, 2018-07-28’)
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 ”)’ at line 1
我尝试了各种网络上的说法,但是折腾了一个小时都没有解决…无聊怎么操作都是这样
然后我就想是不是我设置有问题?然后我尝试不提交dateline的数据,然后成功了…
看上去是我获取的时间跟我的数据库设定不一致,但是苦于不知道什么地方出了问题,我决定尝试设置一下自动记录时间,算是不太完美的解决了我的问题
这个是我数据表的设定,注意到dateline的设置
“默认”那一栏里面选择 CURRENT_TIMESTAMP即可,意思就是当你第一次提交的时候自动记录时间
如果需要自动更新修改的时间需要在属性里面选择 on update CURRENT_TIMESTAMP