SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Tizer's Avatar
    Join Date
    May 2002
    Location
    Beach
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mysql table help

    Hi

    I am trying to install a script which I found on hotscripts. The first part is to create a table using phpMyAdmin - which, surprisingly, where my problem starts:

    Code:
    CREATE TABLE am_chapter (
       fldAuto int(11) NOT NULL auto_increment,
       faq_fldAuto int(11) DEFAULT '0' NOT NULL,
       name varchar(50) NOT NULL,
       orderingfield varchar(10) NOT NULL,
       PRIMARY KEY (fldAuto),
       UNIQUE fldAuto (fldAuto),
       KEY fldAuto_2 (fldAuto, faq_fldAuto)
    );
    When I reun this through phpMyadmin, I get the following:

    MySQL said:

    You have an error in your SQL syntax near '\'0\' NOT NULL,
    name varchar(50) NOT NULL,
    orderingfield varchar(10) NOT' at line 3


    Now I have not got a clue what this means - the only thing which I am not sure about in line 3 is the DEFAULT '0' command. Is this the problem and what does it do???

    Help please

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,215
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    i just tried your sql in mysql 4.0.12 and it gave no error message

    yes, try taking off the quotes around the 0

    stupid mysql, even allowing those sorts of shenanigans in the first place

    i mean, an integer field? assign a default string to an integer field? what's up with that?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •