I am trying to make a script that will allow me to create multiple sql tables through one query in php. Here is what I was trying to use:
PHP Code:
mysql_query("
CREATE TABLE `admins` (
`id` tinyint(4) NOT NULL auto_increment,
`date` varchar(20) NOT NULL,
`username` varchar(32) NOT NULL,
`password` varchar(32) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;
CREATE TABLE `affiliates` (
`id` tinyint(5) NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`image` varchar(100) NOT NULL,
`url` varchar(100) NOT NULL,
`description` mediumtext NOT NULL,
`hits` tinyint(5) NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;
") or die ("Error Creating Tables! \n<br />\n" .mysql_error());
When I run this code, I get this error:
Error Creating Tables!
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE `affiliates` ( `id` tinyint(5) NOT NULL au' at line 8
Is there something I need to add to each line to make this work?
Thanks
Bookmarks