I'm trying to create a table from a PHP script.
From what I read in my book about PHP and MySQL I
should do something like that:
$sql_query="CREATE TABLE '$num' (
'variable1' mediumint(6) unsigned NOT
NULL,
'variable2' smallint(6) unsigned NOT NULL,
PRIMARY KEY(numero),
)";
First I tried without the 'primary key' and the '' for
the names of the variables. My script was not creating
the table so I decided to add the '' and the "primary
key". It was still not working. Then I've found that
this is working:
$sql_query = 'CREATE TABLE $num ('
. ' `variable1` DATE NOT NULL'
. ' )';
I'd like to know why my first test was not working
(cause it is similar to a listing in a book) and if I
really need (it's related) to use the '.' between each
line of my command?
Another problem is that the table is created with the
name $num and is not replaced like I want by its
value. How can I solve this other problem?
Thanks a lot for your help.