php - i try to create table in mysql with use of random() function.?
223
I want to create able in mysql with random name of table name i try but cant created. this is my code
$temp_table=rand(1000,9999);
$sql="CREATE TABLE $temp_table (FirstName CHAR(30),LastName CHAR(30),Age INT)";
Answer
Solution:
Identifiers may begin with a digit but unless quoted may not consist solely of digits. Try doing this instead:
Answer
Solution:
Try quoting the name:
MySQL doesn't like numbers as identifiers. (Or prefix with something like
table_
.)