转义表名有点问题.我是如此愚蠢以至于我选择“show”作为桌子的名字.当我使用mysqli连接时,转义工作正常,但它不能与经典的MysqL连接.有什么建议吗?
对不起我的英语,我不是母语.
SELECT sql_CALC_FOUND_ROWS year,nameShow
FROM `show`
LIMIT 0,10
我得到错误
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 'show' at line 2 –
询问
$sQuery = "
SELECT sql_CALC_FOUND_ROWS year,nameShow
FROM `show`
$sWhere
$sOrder
$sLimit
";
最佳答案
Section 9.3 of MySQL 5.1 Reference Manual 说回嘀嗒(`)或双引号(“),但是,我会按照上面的Fahim Parkar的评论来重新命名.
另外值得注意的是,如果每个Section 9.2使用双引号,则必须使用ANSI_QUOTES sql模式:
If the ANSI_QUOTES sql mode is enabled,it is also permissible to
quote identifiers within double quotation marks