|
Posted by Angelos on 11/09/03 11:18
Hello Everybody !!!
How do you put the folowing code into a php script that will create the
database and then the Tables ?
I tried doing
$sql = '
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `gamoto`;
USE `gamoto`;
';
$result = mysql_query($sql) or die(mysql_error());
But i get errors when I execute the query....
I know the long way of doing it..... (query by query, table by table)
I need a quicker way.... Thanks guys !!!!
*************************************************************************
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `gamoto`;
USE `gamoto`;
DROP TABLE IF EXISTS `cms_access_levels`;
CREATE TABLE `cms_access_levels` (
`access_lvl` int(10) unsigned NOT NULL auto_increment,
`access_lvl_name` varchar(45) NOT NULL default '',
PRIMARY KEY (`access_lvl`,`access_lvl_name`)
) TYPE=MyISAM;
/*!40000 ALTER TABLE `cms_access_levels` DISABLE KEYS */;
INSERT INTO `cms_access_levels` VALUES (1,'user'),
(2,'moderator'),
(3,'admin');
/*!40000 ALTER TABLE `cms_access_levels` ENABLE KEYS */;
DROP TABLE IF EXISTS `cms_users`;
CREATE TABLE `cms_users` (
`cms_user_id` int(10) unsigned NOT NULL auto_increment,
`cms_user_email` varchar(60) NOT NULL default '',
`cms_user_passwd` varchar(50) NOT NULL default '',
`cms_user_name` varchar(45) NOT NULL default '',
`cms_user_surname` varchar(45) NOT NULL default '',
`cms_user_access_lvl` tinyint(4) unsigned NOT NULL default '1',
`cms_customer_id` int(10) unsigned NOT NULL default '0',
PRIMARY KEY
(`cms_user_id`,`cms_user_email`,`cms_user_access_lvl`,`cms_customer_id`)
) TYPE=MyISAM;
***************************************************************************************
Thanks Again
Angelos..
P.S. Gamoto !
Navigation:
[Reply to this message]
|