Click to See Complete Forum and Search --> : mysql and php building tables


pelegk1
12-02-2003, 03:42 AM
1)can i build tables at run time from php?
2) can i add and remove after it col's from my table?
thanks in advance
peleg

pyro
12-02-2003, 11:08 AM
Yes and yes... :)

pelegk1
12-03-2003, 07:29 AM
yes isnt not an answer!:)

pyro
12-03-2003, 07:39 AM
Actually, it is a perfect answer to your questions. ;)

Anyway, for 1, a sample would look something like this:

CREATE TABLE `tablename` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
);

For two, something like this would add a new column named newcol, that is a VARCHAR field with a length of 50:

ALTER TABLE `tablename` ADD `newcol` VARCHAR(50) NOT NULL;

And to drop the same column:

ALTER TABLE `test` DROP `test`;

Paul Jr
12-03-2003, 08:25 PM
Pyro, he said "isn't not", which is a double negative -- meaning he said it is an answer... unless he made a typo...

pelegk1
12-04-2003, 08:32 AM
:)

pyro
12-04-2003, 08:38 AM
:D

Paul Jr
12-04-2003, 12:33 PM
:eek: Now I'm totally and officially confused...