当前位置: 动力学知识库 > 问答 > 编程问答 >

php - How to refer to a table name with a space in it

问题描述:

When I import a csv file in phpmyadmin it automatically calls the table "table 1". Renaming the table is just one extra step I'd rather not take but the code below doesn't work because there's a space in the name. How can I refer to this table called "TABLE 1" when there's a space in the name?

$data = mysql_query("SELECT * FROM TABLE 1")

网友答案:

wrap it in backticks (`)

$data = mysql_query("SELECT * FROM `TABLE 1`");

Note: on a standard keyboard this is the to the left of the numeric "1" key

分享给朋友:
您可能感兴趣的文章:
随机阅读: