Create table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jpenguin
    New Member
    • Aug 2007
    • 41

    #1

    Create table

    My site is being hosted on www.110mb.com
    I tried to fallow an online tutorial, but I still get e rrors

    Code:
    <?php
    // Make a MySQL Connection
    mysql_connect("localhost", "jpenguin_root", "*******") or die(mysql_error());
    mysql_select_db("jpenguin_brain") or die(mysql_error());
    
    // Create a MySQL table in the selected database
    mysql_query("CREATE TABLE example(
    id INT NOT NULL AUTO_INCREMENT, 
    PRIMARY KEY(id),
     name VARCHAR(30), 
     time VARCHAR(30), 
     comment VALCHAR(100)")
     or die(mysql_error());  
    
    echo "Table Created!";
    
    ?>
    I get, "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 'VALCHAR(100)' at line 6"

    I'm trying to learn about MySQL, that's why I'm not using a GUI tool
  • prabirchoudhury
    New Member
    • May 2009
    • 162

    #2
    mysql_query("CR EATE TABLE example(
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(id),
    name VARCHAR(30),
    time VARCHAR(30),
    comment VALCHAR(100)")
    or die(mysql_error ());
    you have a data type spelling mistake on
    Code:
    comment VALCHAR(100)"
    would be
    Code:
    comment VARCHAR(100)"
    :))

    Comment

    • jpenguin
      New Member
      • Aug 2007
      • 41

      #3
      LOL, I can't believe I did that :-)

      Comment

      • prabirchoudhury
        New Member
        • May 2009
        • 162

        #4
        thats happen some time.. :))

        Comment

        Working...