creating a new table with php

wxdqz

New Member
How does the code look to create a new mysql table in php.
I want to get the name of the new table from a text box on a form, and then create a new table with that name when the user press submit (for now I'll stick to just two fields in the table, later I'll expand the functionality so the user can select the number of fields, their names and the var types, but for now i first need to get the creation right).

I tried $result = mysql_query("create table $tablename (id tinyint (4) default '0' not null auto_increment , first varchar(20), second varchar(20), primary key (id), unique id (id) )";
but it does not create a table...
 
Back
Top