Reputation: 27
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?
Upvotes: 1
Views: 96
Reputation: 4194
You would need to use something like this:
$SomeTable = "SomeTable";
$query = 'INSERT INTO `' . $SomeTable . '` SET ... ';
Which uses the ` character instead of quotes
Upvotes: 2