MySQL Escape Table Name

I have a little problem with the name escaping table. I was so stupid that I chose "show" for the table name. When I use the mysqli connection, escaping works fine, but does not work with the classic mysql connection. Any recommendations? Sorry for my English, I'm not a native speaker.

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

I get an error like

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

Inquiry

$sQuery = "
    SELECT SQL_CALC_FOUND_ROWS year, nameShow 
    FROM   `show`
    $sWhere
    $sOrder
    $sLimit
    ";
+5
source share
3 answers

Section 9.3 of the MySQL 5.1 Reference Guide says backticks (`) or double quotes ("), however I would go with Fahim's Parkar Comment above and just rename the table.

, ANSI_QUOTES SQL, 9.2:

ANSI_QUOTES SQL,

+5

YEAR SHOW. YEAR - MySQL. , , .

:

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

Backticks should work fine

try entering a comma after SQL_CALC_FOUND_ROWS,

SELECT SQL_CALC_FOUND_ROWS, year, nameShow 
FROM   `show`
LIMIT 0, 10
+1
source

All Articles