SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: creating table

  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    creating table

    Im using this in telnet to make a table

    create news (id tinyint(11) DEFAULT '0' NOT NULL AUTO_INCREMENT, date TEXT, user TEXT, header TEXT, news BLOB, PRIMARY KEY (id), UNIQUE id (id));
    but for some reasson it isnt working.


    Also can someone tell me what a BLOB is?

  2. #2
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BLOB = Binary Large OBject - it's a field that can store binary data (normal mySQL fields store ASCII encoded text).

    Not sure why it isn't working though - my advice is to install phpMyAdmin from www.phpwizards.net instead as it's much easier to use

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem with this is, in addition to not needing a BLOB field for news, is your create table syntax is not create and:

    create news (id tinyint(11) DEFAULT '0' NOT NULL AUTO_INCREMENT, date TEXT, user TEXT, header TEXT, news BLOB, PRIMARY KEY (id), UNIQUE id (id));


    should actually be

    create table news (id tinyint(11) DEFAULT '0' NOT NULL AUTO_INCREMENT, date TEXT, user TEXT, header TEXT, news BLOB, PRIMARY KEY (id), UNIQUE id (id));

    See the missing word 'table' right after create.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Zealot Alarion's Avatar
    Join Date
    May 2001
    Location
    Virginia
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While Freddy answered the question I would just like to ask:

    why are you using a "default '0'" on your id column? You have it set to auto_increment, and I would NEVER reccomend setting a "default" value for your primary key unless you are in Postgres and referencing a sequence or something... It probably doesn't matter, but it is just not needed AFAIK
    -=Alarion=-
    Protollix - Linux hosting from $3.95/m

  5. #5
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah..thanx


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
  •