myscranton
New member
I am creating an installer with PHP and MySQL. The user enters a prefix for the database tables. How do I create a table with the prefix in front of it? I have tried this but it does not work:
$prefix = $_POST['prefix'];
$qry = "CREATE TABLE $prefix.Users
id INT NOT NULL AUTO INCREMENT,
email VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
)";
mysql_query($qry);
What is wrong?
$prefix = $_POST['prefix'];
$qry = "CREATE TABLE $prefix.Users
id INT NOT NULL AUTO INCREMENT,
email VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
)";
mysql_query($qry);
What is wrong?