now here is the code..
<?php
//include"header.php";
@mysql_connect("localhost", "Admn", "gota") or die("ERROR--CAN'T CONNECT TO SERVER");
@mysql_select_db("tester") or die("ERROR--CAN'T CONNECT TO DB");
/******* Categories *****************************************/
$sql = "
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(11) NOT NULL auto_increment,
`cat_title` varchar(50) NOT NULL default '',
`cats` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
)
";
$result = mysql_query($sql);
switch(mysql_errno()) {
case 1050:
break;
case 0:
$sql = "INSERT INTO `categories` VALUES (1, 'General discussion', '');";
$result = mysql_query($sql)
or die(mysql_error());
break;
default:
die(mysql_error());
break;
}
$a_tables[] = "categories";
/******* Forum Config *************************************************/
$sql = "
CREATE TABLE IF NOT EXISTS `forumconfig` (
`announcement` varchar(255) NOT NULL default '',
`copyright` varchar(255) NOT NULL default '',
`main_table_color` varchar(255) NOT NULL default '',
`main_table_width` varchar(255) NOT NULL default '',
`bgcolor` varchar(200) NOT NULL default ''
)
";
$result = mysql_query($sql);
switch(mysql_errno()) {
case 1050:
break;
case 0:
$sql = "INSERT INTO `forumconfig` VALUES ('Welcome to Chaotic Designz.', '', '#0000004', '650', '#212121');";
$result = mysql_query($sql)
or die(mysql_error());
break;
default:
die(mysql_error());
break;
}
$a_tables[] = "forumconfig";
/******* Forums Table ************************************************/
$sql = "
CREATE TABLE IF NOT EXISTS `forums` (
`fid` int(2) NOT NULL auto_increment,
`title` varchar(100) NOT NULL default '',
`category` varchar(10) NOT NULL default '0',
PRIMARY KEY (`fid`)
)
";
switch(mysql_errno()) {
case 1050:
break;
case 0:
$sql = "INSERT INTO `forums` VALUES (1, 'General Discussion', '1');";
$result = mysql_query($sql)
or die(mysql_error());
break;
default:
die(mysql_error());
break;
}
$a_tables[] = "forums";
/******* Topics Table *************************************************/
$sql = "
CREATE TABLE IF NOT EXISTS `topics` (
`id` int(11) NOT NULL auto_increment,
`Author` varchar(51) NOT NULL default '',
`Title` varchar(25) NOT NULL default '',
`Date` varchar(30) NOT NULL default '0000-00-00',
`Post` blob NOT NULL,
`category` varchar(5) NOT NULL default '0',
`lastpost` varchar(30) NOT NULL default '0000-00-00 00:00:00',
`poc` int(11) NOT NULL default '0',
`cid` int(2) NOT NULL default '0',
PRIMARY KEY (`id`)
)
";
$result = mysql_query($sql);
switch(mysql_errno()) {
case 1050:
break;
case 0:
$sql = "INSERT INTO `topics` VALUES (1, 'Admin', 'Welcome to Chaotic Forum', 'Thu Jul 28 2005 12:07:06', 0x5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e3c6272202f3e0d0a, '4', 'Fri Jul 29 2005 04:07:09', 0, 0);";
$result = mysql_query($sql)
or die(mysql_error());
break;
default:
die(mysql_error());
break;
}
$a_tables[] = "topics";
/******* Alter Members Table *************************************************/
$sql = "
ALTER TABLE `members` ADD `avatar` VARCHAR(100) DEFAULT 'defualt.jpg' NOT NULL,
ADD `warning` TINYINT(11) DEFAULT '0' NOT NULL,
ADD `awidth` INT(2) DEFAULT '95' NOT NULL,
ADD `aheight` INT(2) DEFAULT '95' NOT NULL;
)
";
$result = mysql_query($sql)
or die(mysql_error());
$a_tables[] = "members_alter";
/******* Display Results *********************************************/
foreach ($a_tables as $table) {
$table = str_replace("","",$table);
$table = str_replace("_", " ",$table);
echo "<li>$table</li>\n";
}
echo "Created Successfully\n";
//include"footer.php";?>
all it does is give this error msg:
Parse error: parse error in \home\www\cd\install.php on line 130
its a lil addon into my other scripts...
EDIT: Fixed but now i got a new problem...
Table 'tester.forums' doesn't exist
lol... ill post if i fix it...
Edited by PlaGuEX, 01 August 2005 - 02:04 AM.
