1

When trying to use

$SomeTable = "SomeTable";
INSERT INTO "' . $SomeTable . '" SET ... 

instead of

INSERT INTO SomeTable SET ...

I am unsuccessful. Why am I unable to use a php variable to call a database name?

4

1 回答 1

2

你需要使用这样的东西:

$SomeTable = "SomeTable";
$query = 'INSERT INTO `' . $SomeTable . '` SET ... ';

它使用 ` 字符而不是引号

于 2013-09-13T15:57:57.743 回答