How to make this code working? I have the code:
$tablename = $user_data['id'];
$sql= "CREATE TABLE ".$tablename." (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
YO VARCHAR(30) NOT NULL,
DESTINATARIO VARCHAR(30) NOT NULL,
MENSAJE VARCHAR(100),
reg_date TIMESTAMP
)";
I wana create a TABLE for every client, and i whant the id to be the table name.
The problem is that every time i use $tablename as a table name, like in the example, i got this error:
"Error creating table: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"35599"".
If I change the $tablename with a value like "35599" for example, is creating the table perfectly. Any one knows how to use a the "$tablename" on the sql request?