Escape table name MySQL

后端 未结 3 617
情深已故
情深已故 2021-01-18 04:47

I have a little problem with escaping table name. I was so stupid that i choose \"show\" for the name of table. When I use mysqli connection the escaping works fine, but its

3条回答
  •  日久生厌
    2021-01-18 05:16

    The problem is with YEAR not with SHOW. YEAR is a MySQL function. Best practice is to quote column and tables names all the time, makes things easy to read also.

    Should be:

    SELECT SQL_CALC_FOUND_ROWS `year`, `nameShow` 
    FROM   `show`
    LIMIT 0, 10
    

提交回复
热议问题