What’s wrong with the following code:
$table = $email . "Entries";
$query = "CREATE TABLE ".$table."(FirstName varchar(15),LastName varchar(15),Age int)";
I want to create a table whose name is dynamic based on a posted variable. The above doesn’t work however. I have also tried:
$query = "CREATE TABLE $table(FirstName varchar(15),LastName varchar(15),Age int)";
Any Ideas?
I cannot find the relevant documentation, but would assume that if
$emailcontains an@this would be an invalid table name in MySQL.If this is the case, try enclosing the table name in backticks: