Results 1 to 4 of 4

Thread: Creating mysql DB with php

  1. #1
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Creating mysql DB with php

    Can some one see whats wrong here I dont get any errors but it dont creat DB either I ran it from the IE browser

    PHP Code:
    <?php
    include("access.inc.php");

    $conn mysql_connect(localhost,$username,$password);
    $query 'CREATE  TABLE  `Series`.`SAMPLE` (  `id` int( 10  )  unsigned NOT  NULL  auto_increment , 
    `Name` text NOT  NULL ,
    `Address` text NOT  NULL ,
    `Apt` text NOT  NULL ,
    `City` text NOT  NULL ,
    `State` text NOT  NULL ,
    `ZipCode` text NOT  NULL ,
    `Phone` text NOT  NULL ,
    `E_Mail` text NOT  NULL ,
    `Eighth_Scale_Buggy` text NOT  NULL ,
    `Frequency_1_Buggy` text NOT  NULL ,
    `Frequency_2_Buggy` text NOT  NULL ,
    `Transponder_Buggy` text NOT  NULL ,
    `Skill_Level_Buggy` text NOT  NULL ,
    `Eighth_Scale_Sportsman` text NOT  NULL ,
    `Frequency_1_Sportsman` text NOT  NULL ,
    `Frequency_2_Sportsman` text NOT  NULL ,
    `Transponder_Sportsman` text NOT  NULL ,
    `Skill_Level_Sportsman` text NOT  NULL ,
    `Arena_Truck` text NOT  NULL ,
    `Frequency_1_Arena_Truck` text NOT  NULL ,
    `Frequency_2_Arena_Truck` text NOT  NULL ,
    `Transponder_Arena_Truck` text NOT  NULL ,
    `Skill_Level_Arena_Truck` text NOT  NULL ,
    `Monster_Truck` text NOT  NULL ,
    `Frequency_1_Monster_Truck` text NOT  NULL ,
    `Frequency_2_Monster_Truck` text NOT  NULL ,
    `Transponder_Monster_Truck` text NOT  NULL ,
    `Skill_Level_Monster_Truck` text NOT  NULL ,
    `Stadium_Truck` text NOT  NULL ,
    `Frequency_1_Stadium_Truck` text NOT  NULL ,
    `Frequency_2_Stadium_Truck` text NOT  NULL ,
    `Transponder_Stadium_Truck` text NOT  NULL ,
    `Skill_Level_Stadium_Truck` text NOT  NULL ,
    `Comments` text NOT  NULL ,
    `Attend_Round` text NOT  NULL ,
    `Agree_To_Terms` text NOT  NULL ,
    `Track_Name` text NOT  NULL ,
    `Track_Contact` text NOT  NULL ,
    `Track_Address` text NOT  NULL ,
    `Track_City` text NOT  NULL ,
    `Track_State` text NOT  NULL ,
    `Track_ZipCode` text NOT  NULL ,
    `Track_Phone` text NOT  NULL ,
    `Track__EMail` text NOT  NULL ,
    `Track_WebSite` text NOT  NULL ,
    `IP_Address` text NOT  NULL ,
    `Date_Posted` text NOT  NULL ,
    PRIMARY  KEY (  `id`  ) ,
    UNIQUE  KEY  `id_2` (  `id`  ) ,
    KEY  `id` (  `id`  )  ) ENGINE  =  MyISAM  DEFAULT CHARSET  = latin1 COMMENT  =  \'Created by Kelly\'
    '
    ;
    mysql_query($query);
    ?>

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    You need to select the database using mysql_select_db('mydbname');

    Or you can create it by adding CREATE DATABASE `mydbname`; to your query.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Series is the DB its already created this is to create a table sample in that DB

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Try replacing mysql_query($query); with mysql_query($query) or die(mysql_error());

    What error does it give you?
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

Bookmarks

Posting Permissions

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