phpmyadmin sql撇号不起作用 [英] phpmyadmin sql apostrophe not working
问题描述
嘿伙计们希望你能帮助我,
hey guys was hoping you could help me out,
不确定我是否总是遇到这个问题,或者它是否是新的,在 phpmyadmin 的 sql 选项卡中,它识别的撇号与我输入的不同,例如,
Not sure if I always had this problem or if its new, in phpmyadmin in the sql tab, the apostrophe it recognizes is different from what i type, for example,
当我输入时,它是
SELECT * FROM 'table'
这给了我一个错误,所以我不得不喜欢复制/粘贴一些预建查询的引号,使其看起来像
this gives me an error, so instead I have to like copy/paste the inverted commas of some prebuilt query so that it looks like
SELECT * FROM `table`
看看撇号有什么不同?有什么办法可以解决这个问题?
see how the apostrophes are different? any way I can fix this?
此外,我在网上看到了很多查询,我认为即使我从 php 调用的查询也不需要表名带有撇号.但是用phpmyadmin写的时候可以查询表名不带撇号?
also, i have seen many queries on the web, and i think even queries i call from php dont require table names to have apostrophes. But when write it in phpmyadmin, I can do queries without table names having apostrophes?
提前致谢.
推荐答案
在 MYSQL 中,table
是保留关键字.如果你想在查询中使用mysql中的保留关键字,你必须将它们用反引号(`)括起来.
In MYSQL, table
is a reserved keyword. If you want to use reserved keywords in mysql in query, you have to enclose them in backtick(`).
由于 table
是保留关键字,您查询应该
As table
is reserved keyword you query should be
SELECT * FROM `table`
关于单引号('),在mysql中,它代表字符串值.
Regarding single quote ('), in mysql, it represents string value.
SELECT *, 'table' FROM `table`;
这篇关于phpmyadmin sql撇号不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!