Results 1 to 3 of 3

Thread: [RESOLVED] [[RESOLVED][Stupid Installer.php...lol]]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Resolved [RESOLVED] [[RESOLVED][Stupid Installer.php...lol]]

    Okay im trying to create an installer file for mysql for my scripts...

    so far it works... exept for one slight problem.... for sum reason...
    one table wont create...lol...
    the table is of coarse is teh forums table...
    this is my coding...
    PHP Code:
    <?php
    <title>Chaotic Designz Addon</title>
    //include"header.php";
     
    @mysql_connect("localhost""Admin""g2gb") 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&nbsp;discussion', '')";
        
    $result mysql_query($sql); 

        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); 

        break;

      default:
        die(
    mysql_error());
        break;
    }
    $a_tables[] = "forumconfig";

    /******* Forums Table ************************************************/
    $sql "
    CREATE TABLE IF NOT EXISTS `forums` (
      `fid` int(11) NOT NULL auto_increment,
      `title` varchar(100) NOT NULL default '',
      `category` varchar(50) NOT NULL default '',
      PRIMARY KEY  (`fid`)
    )

    "
    ;

    switch(
    mysql_errno()) {
      case 
    1050:
        break;
      
      case 
    0:
        
    $sql "INSERT INTO `forums` VALUES (1, 'General&nbsp;Discussion', '1')";
        
    $result mysql_query($sql); 
        break;

      default:
        die(
    mysql_error());
        break;
    }
    $a_tables[] = "forums";

    /******* Forum 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); 
        break;

      default:
        die(
    mysql_error());
        break;
    }
    $a_tables[] = "topics";
    /******* Alter Members Table *************************************************/
    $sql =  "ALTER TABLE `members` ADD `avatar` VARCHAR(100) DEFAULT '/images/avatars/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); 

    $a_tables[] = "Addon to members";


    /******* Display Results *********************************************/
    foreach ($a_tables as $table) {
      echo 
    "<li>$table was Created Successfully.</li>\n";

    }

    //include"footer.php";
    ?>
    Last edited by PlaGuE; Aug 7th, 2005 at 01:12 AM.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width