Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL] Dziwny błąd przy tworzeniu bazy
Forum PHP.pl > Forum > Przedszkole
Max Damage
Tak wyglada baza:

  1. <?php
  2. mysql_connect('localhost','user','haslo');
  3. mysql_select_db("nazwa_bazy");
  4.  
  5. $sql="create table forum
  6. nick varchar(16) unsigned not null auto_increment,
  7. haslo char(40) not null,
  8. email varchar(100) not null,
  9. id_artykulu int unsigned not null auto_increment primary key,
  10. temat char(20) not null,
  11. wiadomosc text,
  12. umieszczony datetime not null)";
  13.  
  14. ?>

A taki wyskakuje błąd na stronie:
  1. 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 'unsigned not null auto_increment, haslo char(40) not null, email varchar(100) ' at line 3
phpion
varchar i auto_increment?
mike
Przede wszystkim to (cytujac manuala): "there can be only one auto column and it must be defined as a key".
Poza tym dałeś dla pola nick typ varchar i kazałeś mu się automatycznie zwiąkszać. Jak to widszisz? Będą się dodawać literki i podnosić tak jak leci alfebet? tongue.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.