要注意mysql的保留字!

最近在写一个ecshop注册会员来源统计的时候,其中关键词我用到了key,结果怎么也在数据库里面插入不了.弄了好些天,我一直觉得是程序哪里出错了,最终发现是字段用到了mysql 数据库的保留字key.我字段名也用的是这个key.汗啊.看了mysql数据库字段名设置不当造成的麻烦真的是非常吐血 。

查看了一些资料,要解决这个问题实际上也可以用Tab键上面的~(撇)这个括起来。但是还是不要用保留字来做字段的好。记住这个教训。

Comments (3)

糊涂老仙六月 17th, 2011 at 5:26 下午

我也一样。我在用kingcms的过程中定义了一个order,不带任何前缀。我发现必须加个“才行。后来我查了半天发现是order是保留字。。。记得注意。。。。

Jerry七月 16th, 2011 at 10:01 下午

你好,看到你在ecshop论坛的留言,说data/config.php这个文件突然为空了。我也遇到同样的问题,请问你发现是什么原因导致的了吗?

admin七月 17th, 2011 at 7:46 下午

我的应该是程序引起的,因为我对config.php这个文件增加了内容。

Leave a comment

Your comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word