OrganizedChaos
MIS
I was wondering if it is possible to use variables in a sql statement when creating MySQL tables..
For example, if I wanted to add a table called "good" to my database, this would be it..
well, what if I wanted the table to be dynamic, based on user input?
I thought that would work and I have tried other variants, but cannot get it to work... Any ideas?
For example, if I wanted to add a table called "good" to my database, this would be it..
Code:
$sql = 'CREATE TABLE `good`(
`id` int( 5 ) NOT NULL AUTO_INCREMENT ,
`good` int( 4 ) NOT NULL,
PRIMARY KEY ( `id` ) ,
) TYPE = MYISAM ';
well, what if I wanted the table to be dynamic, based on user input?
Code:
$good="`good`";
$sql = 'CREATE TABLE $good (
`id` int( 5 ) NOT NULL AUTO_INCREMENT ,
`good` int( 4 ) NOT NULL,
PRIMARY KEY ( `id` ) ,
) TYPE = MYISAM ';
I thought that would work and I have tried other variants, but cannot get it to work... Any ideas?