[SQL allgemein] primary_increament

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SQL allgemein] primary_increament

    habe ein Problem. Ich habe eine Tabealle (Reviews) mit folgenden Splaten erstellt:

    ID
    buchstabe
    review_name
    text
    bewertung

    Jetzt möchte ich das sich die ID selbständig um eins nach jedem Eintrag erhöht. dazu habe ich den TYP auf "TINYINT" gesetzt und primary_increment eingeschaltet. Aber ich bekomme von phpmyadmin immer folgenden fehler:

    "Incorrect table definition; There can only be one auto column and it must be defined as a key"


    Kann mir einer sagenw as ich falsch mache ?
    Last edited by g0n; 16-08-2003, 13:15.

  • #2
    du musst es auf auto_inctement setzen.

    auch würde ich nicht tiny nehmen, sonder ein richtiges int...
    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


    Comment


    • #3
      Mh, entweder ich habe eine alte phpmyadmin version ( glaube ich aber nicht ) ooder ich finde einfach dieses auo incment nicht. ^^#

      Comment


      • #4
        poste mal deine bisherige CREATE anweisung
        INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


        Comment


        • #5
          PHP Code:

          <?


          $verbindung = mysql_connect("localhost", "root", "");
          $db_name = "cms";
          $sql = "CREATE Database $db_name";
          mysql_query($sql);
          echo mysql_error();

          mysql_select_db($db_name, $verbindung);
          $sql = "CREATE TABLE `reviews` (
          `id` VARCHAR( 3 ) NOT NULL ,
          `buchstabe` VARCHAR( 2 ) NOT NULL ,
          `titel` VARCHAR( 20 ) NOT NULL ,
          `text` TEXT NOT NULL ,
          `bewertung` VARCHAR( 5 ) NOT NULL
          );";
          $ergebnis = mysql_query($sql, $verbindung);

          echo mysql_error();
          ?>

          Comment


          • #6
            damit gehts
            Code:
            CREATE TABLE reviews (
              id int(11) NOT NULL auto_increment,
              buchstabe char(2) NOT NULL default '',
              titel varchar(20) NOT NULL default '',
              text text NOT NULL,
              bewertung varchar(5) NOT NULL default '',
              PRIMARY KEY  (id)
            ) TYPE=MyISAM;
            INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


            Comment

            Working...
            X