0
I’m trying to create a table from the user’s email, and I’m using the code below:
$email = $_SESSION["email"];
echo $email;
$create=mysql_query("CREATE TABLE userpics_'$email' (id_user VARCHAR(60), id_pic VARCHAR(200), id_tipo INT(2))");
if (mysql_query($create))
{
echo "TABLE created.";
}
else
{
echo "Error in CREATE TABLE.";
}
If the user is the [email protected],
the table name should be [email protected]
.
With this code, I receive the message "Error in CREATE TABLE." else
.
Can anyone tell me where I might be going wrong? Maybe it’s a syntax error.
It is probably because of the arroba(@) in the table name, try to use another form, no special characters.
– touchmx
@touchmx is right, that may be so. I will do some other tests with other type of information. Thank you.
– Vitor de Oliveira
mysql allows tables with "@". The problem is not that.
– Euler01
The character
.
is used to separate the database name from the table name. I think this is creating a confusion. Use quoted Dentifiers (name between crases).– anonimo